API REFERENCE
Bon d’achat
Paramètres
| Parameter | Type | Description | Obligatoire |
|---|---|---|---|
| data.pay_method | string | online | ✓ |
| data.sub_pay_method | string | Voucher | ✓ |
| data.order_id | string | 商户的订单ID | ✓ |
| data.amount | string | 金额数字。例如 € 24.99 应该写成24.99,欧元金额>=1 | ✓ |
| data.currency | string | EUR | ✓ |
| data.description | string | 订单描述 | ✓ |
| data.demo | string | 自定义字段 | — |
| data.timeout | string | 过期时间单位分钟(0-1440) | ✓ |
| data.redirect_url | string | 如果使用托管页面,支付完成后跳转地址 | — |
| data.notify_url | string | 支付完成后异步通知地址 | ✓ |
| data.cardnumber | string | 礼品卡卡号(如使用页面跳转托管方式非必填) | — |
| data.pincode | string | 礼品卡密码(如传cardnumber该字段必填) | — |
S’applique aux cartes-cadeaux
Ce moyen de paiement utilise le solde d’une carte-cadeau pour régler une commande. Les cartes-cadeaux doivent être activées au point de vente.
| Paramètre | Type | Description | Obligatoire |
|---|---|---|---|
| user | String | Compte caissier UID | Obligatoire |
| sign | String | Signature | Obligatoire |
| method | String | v3.CreatePaymentsVoucher | Obligatoire |
| time | Long | Timestamp | Obligatoire |
- Parameters | Paramètre | Type | Description | Obligatoire | |:--- |:--- |:--- |:--- | | pay_method | String | online | Obligatoire | | sub_pay_method | String | Voucher | Obligatoire | | order_id | String | ID de commande du marchand | Obligatoire | | amount | String | Montant numérique. Par exemple, € 24.99 doit être indiqué comme 24.99 ; le montant minimum en euros est >=1 | Obligatoire | | currency | String | EUR | Obligatoire | | description | String | Description de la commande | Obligatoire | | demo | String | Champ personnalisé | Facultatif | | timeout | String | Délai d’expiration en minutes (0-1440) | Obligatoire | | redirect_url | String | URL de redirection après le paiement lorsque la page hébergée est utilisée | Facultatif | | notify_url | String | URL de notification asynchrone après le paiement | Obligatoire | | cardnumber | String | Numéro de carte-cadeau (non requis lorsque la redirection vers la page hébergée est utilisée) | Facultatif | | pincode | String | Code PIN de la carte-cadeau (obligatoire si cardnumber est fourni) | Facultatif |
Exemple de signature :
Paramètres triés et concaténés dans une chaîne de requête au format 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=YOUR_CASHIER_UID"
Signer stringA avec secret_key
La signature obtenue est :
"YOUR_SIGNATURE"
Exemple de requête :
{
"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"
}
}
Exemple de réponse :
{
"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": ""
}
Intégration de la page hébergée :
Cette méthode permet de vérifier le numéro de carte-cadeau et le code PIN sur la page hébergée YabandPay. Dans ce cas, ne transmettez pas cardnumber ni pincode. Après l’appel de l’API, redirigez l’utilisateur vers l’url renvoyée pour poursuivre le paiement.
Exemple de requête :
{
"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"
}
}
Exemple de réponse :
{
"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": ""
}
Informations complémentaires :
Résultat de la réponse :
-
Une requête réussie renvoie "status": true.
-
Une requête échouée renvoie "status": false.
Nous recommandons vivement d’utiliser à la fois Consultation de commande et Notifications asynchrones afin de maintenir des statuts de paiement exacts et à jour.
Codes de réponse :
| 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 |
