Difference between revisions of "MOR API user balance get"
From Kolmisoft Wiki
Jump to navigationJump to search
m (moved MOR API balance to MOR API user balance get) |
|||
Line 23: | Line 23: | ||
* username – username of user whose balance you want to get. | * username – username of user whose balance you want to get. | ||
* currency – currency code. | * currency – currency code. | ||
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''tariff_id''' and/or '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''. | |||
<br><br> | <br><br> | ||
===Request=== | ===Request=== | ||
Revision as of 08:46, 25 May 2013
Description
This feature enables you to check the balance over http.
Configuration
1. Go to SETTINGS –> Setup –> Settings
2. In Various tab check the marked option (in MOR 12 this option was moved to API tab):
Usage
- Call: /billing/api/user_balance_get
- For Backwards-compatibility old name 'balance' is also usable. Call: /billing/api/balance
- Methods: POST, GET(if allowed, not recomended)
Parametres
- username – username of user whose balance you want to get.
- currency – currency code.
- hash - SHA1 hash constructed using tariff_id and/or user_id and API_Secret_Key ( More described in Constructing hash). Required.
Request
HTML POST: http://<SERVER_IP>/billing/api/user_balance_get?username=USERNAME
Optionaly you can specify currency, valid values are USER, in that case balance is returned in user's currency. And currency code(EUR, USD etc.)
HTML POST: http://<SERVER_IP>/billing/api/user_balance_get?username=USERNAME¤cy={USER|CURRENCY_CODE}
Returns
Success returns balance of user.
<?xml version="1.0" encoding="UTF-8"?> <page> <balance> user balance </balance> </page>
Errors
When hash is incorrect.
<?xml version="1.0" encoding="UTF-8"?> <status> <error>Incorrect hash</error> </status>
When user is not found.
<?xml version="1.0" encoding="UTF-8"?> <page> <error>User was not found</error> </page>
When feature is off.
<?xml version="1.0" encoding="UTF-8"?> <page> <error>Feature disabled</error> </page>