API REFERENCE
Voucher
Applies to: gift cards
This payment method uses gift card funds to pay for an order. Gift cards must be activated at the point of sale.
| Parameter | Type | Description | Required |
|---|---|---|---|
| user | String | Cashier account UID | Required |
| sign | String | Signature | Required |
| method | String | v3.CreatePaymentsVoucher | Required |
| time | Long | Timestamp | Required |
- Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| pay_method | String | online | Required |
| sub_pay_method | String | Voucher | Required |
| order_id | String | Merchant order ID | Required |
| amount | String | Numeric amount. For example, € 24.99 must be written as 24.99; euro amount>=1 | Required |
| currency | String | EUR | Required |
| description | String | Order description | Required |
| demo | String | Custom field | Optional |
| timeout | String | Expiration time in minutes (0-1440) | Required |
| redirect_url | String | Redirect URL after payment completion when using the hosted page | Optional |
| notify_url | String | Asynchronous notification URL after payment | Required |
| cardnumber | String | Gift card number (not required when redirecting to the hosted page) | Optional |
| pincode | String | Gift card PIN (required if cardnumber is provided) | Optional |
Signature example:
Sorted parameters concatenated into a URL-style query string
"amount=0.01&cardnumber=6064364245787814896¤cy=EUR&demo=test&description=YabandPay test VVV&method=v3.CreatePaymentsVoucher¬ify_url=https://www.yabandpay.com/notify&order_id=202405110140188881&pay_method=online&pincode=568971&redirect_url=https://www.yabandpay.com&sub_pay_method=Voucher&time=1546588959&timeout=0&user=YOUR_CASHIER_UID"
Sign stringA using secret_key
The resulting signature is:
"YOUR_SIGNATURE"
Request example:
{
"user": "YOUR_CASHIER_UID",
"sign": "YOUR_SIGNATURE",
"method": "v3.CreatePaymentsVoucher",
"time": 1546588959,
"data": {
"description": "YabandPay test VVV",
"timeout": "0",
"pay_method": "online",
"sub_pay_method": "Voucher",
"order_id": "YOUR_ORDER_ID",
"amount": "0.01",
"currency": "EUR",
"redirect_url": "https://www.yabandpay.com",
"notify_url": "https://www.yabandpay.com/notify",
"demo": "test",
"cardnumber": "6064364245787814896",
"pincode": "568971"
}
}
Response example:
{
"status": true,
"code": "200",
"data": {
"order_id": "YOUR_ORDER_ID",
"trade_id": "535ea4a1-917a-bc14-58e2-d1565720af90",
"amount": "0.01",
"currency": "EUR",
"settlement_amount": "0.01",
"settlement_currency": "EUR",
"exchange_rate": "1",
"url": "",
"state": "processing"
},
"message": ""
}
Hosted page integration:
Use this method to verify the gift card number and PIN on the YabandPay hosted page. In this case, do not pass cardnumber or pincode. After the API call, redirect to the returned url to continue the payment flow.
Request example:
{
"user": "YOUR_CASHIER_UID",
"sign": "YOUR_SIGNATURE",
"method": "v3.CreatePaymentsVoucher",
"time": 1546588959,
"data": {
"description": "YabandPay test VVV",
"timeout": "0",
"pay_method": "online",
"sub_pay_method": "Voucher",
"order_id": "YOUR_ORDER_ID",
"amount": "0.01",
"currency": "EUR",
"redirect_url": "https://www.yabandpay.com",
"notify_url": "https://www.yabandpay.com/notify",
"demo": "test"
}
}
Response example:
{
"status": true,
"code": "200",
"data": {
"order_id": "YOUR_ORDER_ID",
"trade_id": "c0d9c0bb-0b40-1cb6-7373-fd1a97c7124e",
"amount": "0.01",
"currency": "EUR",
"url": "https://pay.yabandpay.com/payments/callback/order/YzBkOWMwYmItMGI0MC0xY2I2LTczNzMtZmQxYTk3YzcxMjRl",
"state": "processing"
},
"message": ""
}
Additional information:
Response result:
-
A successful request returns "status": true.
-
A failed request returns "status": false.
We strongly recommend using both Query Order and Asynchronous Notifications to keep payment statuses accurate and up to date.
Response codes:
| Status | Code | Message |
|---|---|---|
| true | 200 | |
| false | -1000 | Internal error |
| false | -104000 | You have entered an invalid amount |
| false | -104221 | The voucher has insufficient funds |
| false | -104222 | Invaild PinCode |
| false | -104223 | This is an invalid giftcard, we are unable to find the giftcard brand |
