Voucher
适用于:礼品卡
该支付方式通过使用礼品卡的资金支付订单。礼品卡必须在销售地点激活。
API URL:https://mapi.yabandpay.com/Payments
Method:POST
POST data type:Json
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| user | String | 收银员账号的UID | 必填 |
| sign | String | 签名 | 必填 |
| method | String | v3.CreatePaymentsVoucher | 必填 |
| time | Long | 时间戳 | 必填 |
- 参数
| Parameter | Type | Description | 是否必填 |
|---|---|---|---|
| pay_method | String | online | 必填 |
| sub_pay_method | String | Voucher | 必填 |
| order_id | String | 商户的订单ID | 必填 |
| amount | String | 金额数字。例如 € 24.99 应该写成24.99,欧元金额>=1 | 必填 |
| currency | String | EUR | 必填 |
| description | String | 订单描述 | 必填 |
| demo | String | 自定义字段 | 选填 |
| timeout | String | 过期时间单位分钟(0-1440) | 必填 |
| redirect_url | String | 如果使用托管页面,支付完成后跳转地址 | 选填 |
| notify_url | String | 支付完成后异步通知地址 | 必填 |
| cardnumber | String | 礼品卡卡号(如使用页面跳转托管方式非必填) | 选填 |
| pincode | String | 礼品卡密码(如传cardnumber该字段必填) | 选填 |
签名示例:
拼接为URL方式并排序后的字符串
"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=016683"
得到的 stringA 使用 secret_key做签名
得到的签名如下:
"581bfde2ffe3208f470e5448a035464079b91df58db618ac15f0a2cf04236347"
提交示例:
{
"user": "016683",
"sign": "581bfde2ffe3208f470e5448a035464079b91df58db618ac15f0a2cf04236347",
"method": "v3.CreatePaymentsVoucher",
"time": 1546588959,
"data": {
"description": "YabandPay test VVV",
"timeout": "0",
"pay_method": "online",
"sub_pay_method": "Voucher",
"order_id": "202405110140188881",
"amount": "0.01",
"currency": "EUR",
"redirect_url": "https://www.yabandpay.com",
"notify_url": "https://www.yabandpay.com/notify",
"demo": "test",
"cardnumber": "6064364245787814896",
"pincode": "568971"
}
}
返回示例:
{
"status": true,
"code": "200",
"data": {
"order_id": "202405110140188881",
"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": ""
}
托管页面方式:
如需要在YabandPay的托管页面上完成礼品卡的账号和密码验证,请使用该支付方式。这时cardnumber和pincode不用传。在调用后跳转到返回url进行下一步的支付流程。
提交示例:
{
"user": "016683",
"sign": "ce23d2d12eff66fa9f48ce577f61b7bad86aae6067a4d83610a65c7a063900bd",
"method": "v3.CreatePaymentsVoucher",
"time": 1546588959,
"data": {
"description": "YabandPay test VVV",
"timeout": "0",
"pay_method": "online",
"sub_pay_method": "Voucher",
"order_id": "20240511014018888",
"amount": "0.01",
"currency": "EUR",
"redirect_url": "https://www.yabandpay.com",
"notify_url": "https://www.yabandpay.com/notify",
"demo": "test"
}
}
返回示例:
{
"status": true,
"code": "200",
"data": {
"order_id": "20240511014018888",
"trade_id": "c0d9c0bb-0b40-1cb6-7373-fd1a97c7124e",
"amount": "0.01",
"currency": "EUR",
"url": "https://pay.yabandpay.com/payments/callback/order/YzBkOWMwYmItMGI0MC0xY2I2LTczNzMtZmQxYTk3YzcxMjRl",
"state": "processing"
},
"message": ""
}
更多信息:
返回结果:
若调用成功,则返回
"status": true若调用失败,则返回
"status": false
我们强烈建议同时使用订单查询和异步通知来同步和更新支付状态,以确保支付信息的实时准确性。
返回代码:
| 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 |