MOR API voucher use

From Kolmisoft Wiki

Jump to: navigation, search


[edit] Description

MOR API Voucher use

Please note that only admins users and admin can use this API.

[edit] Usage

  • Call: /api/voucher_use
  • Methods: POST, GET(if allowed, not recomended)

[edit] Parametres

  • u – username to login. Required.
  • voucher_number – this is number of voucher which will be used. Required.
  • user_id - this is the id of the user whose balance will be updated. Optional
  • hash – SHA1 hash constructed using voucher_number and API_Secret_Key ( More described in Constructing hash). Required.

[edit] Request

We have API Secret Key = 123456, voucher_number = 10007
We send:

HTML POST: http://<server_ip>/billing/api/voucher_use?u=admin&user_id=2&voucher_number=10007&test=1&hash=d180bb861a4ee06850bc2fe40e2b8d2ab369e27f 

* Note that username and password are not included in hash

[edit] Returns


   <status>Voucher used to update balance</status>


  • <error>Voucher was not found</error> – Voucher was not found (Might be expired or already used).
  • <error>Vouchers Disabled</error> – Vouchers are disabled.
  • <error>Access Denied</error> – username (u) is not admins user or admin.
  • <error>User was not found</error> – specified user via user_id does not exist or his owner is not admin
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.

[edit] See also

Personal tools


Try M2