Voucher API

Voucher API – Pay

Using this API, you will be able to allow customers to pay for products and/or services using WiPay Vouchers. You must have a WiPay Business Verified account to use this API.

(OLD) Your WiPay account level must be at Gold (KYC Level 3) to use this API.

Configuration

The configuration for the Voucher API calls can be seen below.

NOTE: When testing, please use the SANDBOX API URL.

API URL (Live) https://wipayfinancial.com/v1/voucher_pay
API URL (Sandbox) https://sandbox.wipayfinancial.com/v1/voucher_pay
HTTP Method POST
Body Content-Type application/x-www-form-urlencoded
API Response-Type JSON Object

Parameters

The Voucher API call can be passed with four (4) parameters.

Parameter Description  Notes  Required
account_number
developer_id(old)
Your WiPay account number. 1. Can be found in your Account Dashboard. Yes
details An optional description of the transaction. 1. Must be less than 255 characters long. No
total The total desired to be subtracted from the voucher value. 1. Must be a value greater than “0”.
2. Must contain no more than two (2) decimal places.
3. Must be numeric only.
4. Flat transaction fee of $5.00 TTD is always added to total.
Yes
voucher The 12-digit voucher number. 1. Voucher’s current value must be greater than “5”.  Yes

Test Parameters

You may use these parameters to make a test Voucher API call using the Sandbox API URL.

Parameter Valid Test Value(s)
account_number
developer_id(old)
4630
details "This is a test Voucher Payment"
total 0.01 (or more)
voucher uyr8vmap230t
jxaqe48tfvbs
zmq8x0y29usv
xq62mu0s81jv
b4zytr8e37si
6v75kwyg3t0i

Responses

All Voucher API calls return a JSON object. There are two main types of responses; “success” and “error“. These response types can be found in the value of the “statuskey in the JSON response object.


Success

If all submitted data is valid, you will receive a JSON response object indicating a “successvalue for the “statuskey. Here, “value” is 5-greater-than-“total” less than the original value of the voucher before the form was submitted. Below is an example of a successful transaction using the Voucher API.

{
    "status": "success",
    "msg": "Voucher payment successful",
    "trxn_id": "5bda8f887426f",
    "value": "75.00"
}

 


Error

error” responses may be received for various reasons. Check the value of the “msgkey in the JSON response object to diagnose what your specific error may be caused by. The following is an example of  an “error” response.

{
    "status": "error",
    "msg": "Too many attempts"
}

The possible values of the “msgkey in an “error” type response are as follows:

Error Message Likely Cause
Parameter: account_number is missing The submitted account_number or developer_id(old) in the API call is empty.
Parameter: account_number is unauthorized The account attached to the submitted account_number or developer_id(old) in the API call is not Verified or KYC Level too low(old).
Parameter: account_number not found There is no registered WiPay account with an Account Number that matches the submitted account_number or developer_id(old) in the API call.
Parameter: total cannot be less than 0 The submitted total in the API call is negative.
Parameter: total has incorrect format The submitted total in the API call is either non-numeric, or has too many decimal places.
Parameter: total is missing The submitted total in the API call is empty.
Parameter: voucher is missing The submitted voucher in the API call is empty.
Parameter: voucher not found There is no registered WiPay Voucher with a Voucher Number that matches the submitted voucher in the API call.
Parameter: voucher value insufficient The current value of the submitted voucher in the API call is too low to make a successful transaction.
Too many attempts There were more than five (5) API calls within the last sixty (60) seconds.