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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
serialStringSerial number of voucher to use.Yes
customerIntegerID of customer to top up.NoCustomer of authentication user.

Responses

CodeDescription
200Success.
400Invalid customer specified, or customer is not prepaid.
401The authentication details provided are invalid.
402Your role does not allow this.
404The 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

VersionChanges
3.13Function added.