API REFERENCE
Paiements via Mini Program
Paramètres
| Parameter | Type | Description | Obligatoire |
|---|---|---|---|
| data.pay_method | string | online | ✓ |
| data.sub_pay_method | string | WeChat Pay | ✓ |
| data.order_id | string | 商户的订单ID | ✓ |
| data.amount | string | 金额数字。例如 € 24.99 应该写成24.99,CNY金额>=1,欧元金额>=0.1 | ✓ |
| data.currency | string | 货币代码,ISO 4217,例如EUR,CHF | ✓ |
| data.description | string | 订单描述 | ✓ |
| data.demo | string | 自定义字段 | — |
| data.timeout | string | 过期时间单位分钟(0-1440) | ✓ |
| data.notify_url | string | 支付完成后异步通知地址 | ✓ |
| data.sub_app_id | string | 小程序的APPID | ✓ |
| data.sub_open_id | string | 小程序获得的用户OpenID | ✓ |
Conseil
Remarque : communiquez à YabandPay l’AppID de votre Mini Program WeChat. Cette fonctionnalité doit être activée avant utilisation.
| Paramètre | Type | Description | Obligatoire |
|---|---|---|---|
| user | String | Compte marchand UID | Obligatoire |
| sign | String | Signature | Obligatoire |
| method | String | v3.CreatePaymentsWechatMiniPay | Obligatoire |
| time | Long | Timestamp | Obligatoire |
- Parameters | Paramètre | Type | Description | Obligatoire | |:--- |:--- |:--- |:--- | | pay_method | String | online | Obligatoire | | sub_pay_method | String | WeChat Pay | Obligatoire | | order_id | String | ID de commande du marchand | Obligatoire | | amount | String | Montant au format chaîne numérique. Par exemple, saisissez 24.99 for € 24.99. montant en CNY ≥1; montant en EUR ≥0.1. | Obligatoire | | currency | String | code devise ISO 4217, par exemple EUR ou CHF | Obligatoire | | description | String | Description de la commande | Obligatoire | | demo | String | Champ personnalisé | Facultatif | | timeout | String | Durée d’expiration en minutes (0-1440) | Obligatoire | | notify_url | String | URL de notification asynchrone après le paiement | Obligatoire | | sub_app_id | String | APPID du Mini Program | Obligatoire | | sub_open_id | String | OpenID utilisateur obtenu par le Mini Program | Obligatoire |
Exemple de signature:
Paramètres triés et concaténés sous forme de chaîne de requête au format URL
"amount=1.23¤cy=EUR&description=test&method=v3.CreatePaymentsWechatMiniPay¬ify_url=https://imenuapi.yabandpay.com/api/Notify/yabandpay&order_id=202413271095510835&pay_method=online&sub_app_id=wx7a5355d3d2a904a4&sub_open_id=opilP5dyazU7pTpyps8TDc53OGyU&sub_pay_method=WeChat Pay&time=1732672545&timeout=300&user=011844"
Signez la chaîne A à l’aide de secret_key
La signature obtenue est :
"YOUR_SIGNATURE"
Exemple de requête:
{
"user": "011844",
"sign": "YOUR_SIGNATURE",
"method": "v3.CreatePaymentsWechatMiniPay",
"time": 1732672545,
"data": {
"description": "test",
"timeout": "300",
"pay_method": "online",
"sub_pay_method": "WeChat Pay",
"order_id": "YOUR_ORDER_ID",
"amount": "1.23",
"currency": "EUR",
"notify_url": "https://imenuapi.yabandpay.com/api/Notify/yabandpay",
"sub_open_id": "opilP5dyazU7pTpyps8TDc53OGyU",
"sub_app_id": "wx7a5355d3d2a904a4"
}
}
Exemple de réponse:
{
"status": true,
"code": "200",
"data": {
"order_id": "YOUR_ORDER_ID",
"trade_id": "e405c9d5-069f-34f5-9eb2-16919cd7e411",
"amount": "1.23",
"currency": "EUR",
"parameters": {
"appId": "wx7a5355d3d2a904a4",
"package": "prepay_id=wx270959141300258779d83459e08e4b0000",
"paySign": "Av83Y6u+Ua8hkU3VyoAN5MUu7cm9vPfID8OstMkS+3BbbNnl1bax5nRapKoFTz2DUzaGyzPiT+gDUzyGW7DshqPLy+NsmKvQGSQM5vyfSjXsz5F4LKOeI3YaaUBTnVXkKX6qBrzbVUfStyjvYwtqPJUXx0X2zZEiGV5ScEf44IOmWQXeiRKyv8j34KnhMHcSFgSVAPN/B10Z1BnN34VUpak6DyaM/d0zfEkUbtODzD260An9NBSKZqAg1Wh35o/Eebqd5KoPIPX74lfRjUH4O9IZUCXnb2NqTxCR2M8j7Yx5zzz3xiQGhqEPzc7m0vXQTYv3TjD+158LeF993e/c2w==",
"nonceStr": "0ypozLSDOzutrUA7WUI7eTfWUHtDqO9n",
"signType": "RSA",
"timeStamp": "1732672754"
},
"state": "processing"
},
"message": ""
}
Utilisez la valeur « parameters » renvoyée pour lancer le paiement WeChat Mini Program.
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 Consulter la commande and Asynchronous Notifications afin de maintenir les statuts de paiement exacts et à jour.
Codes de réponse:
| Status | Code | Message |
|---|---|---|
| true | 200 | Success |
| false | -1000 | Internal error |
| false | -3001 | Required field is missing |
| false | -403 | The signature Error |
| false | -4011 | Not support the payment method |
