Difference between revisions of "MOR API user balance update"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 5: Line 5:


Login and change user balance.  
Login and change user balance.  
This method increases/decreases use balance witch specified amount of money.


<br><br>
<br><br>

Revision as of 08:57, 6 March 2013

This functionality is available from MOR 10


MOR API

Login and change user balance.

This method increases/decreases use balance witch specified amount of money.






  • Call: /api/user_balance_change
  • Methods: POST, GET(if allowed, not recomended)
  • Params:
    • user_id - Users ID in MOR database, whose balance we want to change. Required.
    • u - username to login. Required. (The user which changes balance: admin/reseller, not the user himself!)
    • p - password to login. Required. (Same as above)
    • balance - new user balance. Required.
    • hash - SHA1 hash constructed using user_id, balance and API_Secret_Key ( More described in Constructing hash). Required.
  • Returns:
    • Errors:
      • <error>User was not found</error> - User was not found using user_id. Use correct user_id.
      • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
      • <error>Bad login</error> - User not loged in the system. Check username and password.
      • <error>User balance not updated</error> - Params balance is not correct or user is not saved. Check balance param.



Additional notes

  • If the balance is changed during the call, price for the call will be deducted from new balance, because balance is deducted at the end of call.




  • Example:
    • We have user_id = 123, API Secret Key = 456789, balance = 100
    • Hash string to be converted: "123100456789"
    • We send:
      • /api/user_balance_change?u=admin&p=admin&user_id=123&balance=100&hash=b1bef44691c237b574263e09b2838ad1e658e507

* Note that username and password are not included in hash