JSON API » vouchers » vouchers/use
Uses a voucher, topping up the customer's balance. The customer's billing type must be one of the prepaid types. The voucher must be owned by the customer's parent.
Input parameters
Requires authentication and the payment role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
serial | String | Serial number of voucher to use. | Yes | |
customer | Integer | ID of customer to top up. | No | Customer of authentication user. |
Responses
Code | Description |
---|---|
200 | Success. |
400 | Invalid customer specified, or customer is not prepaid. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
404 | The voucher does not exist, or cannot be used. Check the key and message fields for more details. |
Data returned
The amount of the topup in the customer's currency, and the customer's new balance.
Example: With required parameters
http://enswitch.example.com/api/json/vouchers/use/?auth_username=user;auth_password=password;serial=1234567890{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "amount":"10.00", "balance":"20.00" }, }
Change history
Version | Changes |
---|---|
3.13 | Function added. |