API REFERENCE
Pagos en mini programas
Parámetros
| Parameter | Type | Descripción | Obligatorio |
|---|---|---|---|
| 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 | ✓ |
Consejo
Nota: proporcione a YabandPay el AppID de su mini programa de WeChat. La función debe activarse antes de utilizarla.
| Parámetro | Tipo | Descripción | Obligatorio |
|---|---|---|---|
| user | String | Cuenta de cajero UID | Obligatorio |
| sign | String | Signature | Obligatorio |
| method | String | v3.CreatePaymentsWechatMiniPay | Obligatorio |
| time | Long | Timestamp | Obligatorio |
- Parámetros
| Parámetro | Tipo | Descripción | Obligatorio |
|---|---|---|---|
| pay_method | String | online | Obligatorio |
| sub_pay_method | String | WeChat Pay | Obligatorio |
| order_id | String | ID de pedido del comercio | Obligatorio |
| amount | String | Importe como cadena numérica. Por ejemplo, introduzca 24.99 for € 24.99. importe en CNY >=1; importe en EUR >=0.1. | Obligatorio |
| currency | String | ISO 4217 código de moneda, por ejemplo EUR or CHF | Obligatorio |
| description | String | Descripción del pedido | Obligatorio |
| demo | String | Campo personalizado | Opcional |
| timeout | String | Tiempo de expiración en minutos (0-1440) | Obligatorio |
| notify_url | String | URL de notificación asíncrona tras el pago | Obligatorio |
| sub_app_id | String | Mini Program APPID | Obligatorio |
| sub_open_id | String | User OpenID obtained by the Mini Program | Obligatorio |
Ejemplo de firma:
Parámetros ordenados y concatenados en una cadena de consulta con formato de 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"
Firme la cadena A con secret_key
La firma resultante es:
"YOUR_SIGNATURE"
Ejemplo de solicitud:
{
"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"
}
}
Ejemplo de respuesta:
{
"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": ""
}
Use the returned value of “parameters” to launch WeChat Mini Program payment.
Información adicional:
Resultado de la respuesta:
-
Una solicitud correcta devuelve "status": true.
-
Una solicitud fallida devuelve "status": false.
Recomendamos encarecidamente utilizar tanto Consulta de pedido and Notificaciones asíncronas para mantener los estados de pago precisos y actualizados.
Códigos de respuesta:
| 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 |
