API REFERENCE
Pagamentos H5
Parâmetros
| Parameter | Type | Descrição | Obrigatório |
|---|---|---|---|
| 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 | E货币代码,ISO 4217,例如EUR,CHF | ✓ |
| data.description | string | 订单描述 | ✓ |
| data.demo | string | 自定义字段 | — |
| data.timeout | string | 过期时间单位分钟(0-1440) | ✓ |
| data.notify_url | string | 支付完成后异步通知地址 | ✓ |
| data.redirect_url | string | 支付完成后跳转地址 | — |
| data.ip_address | string | Ip地址 | ✓ |
Dica
Nota: o WeChat não suporta pagamentos H5 por predefinição. Solicite à YabandPay a ativação desta funcionalidade antes de a utilizar.
| Parâmetro | Tipo | Descrição | Obrigatório |
|---|---|---|---|
| user | String | Conta do operador de caixa UID | Obrigatório |
| sign | String | Signature | Obrigatório |
| method | String | v3.CreatePaymentsWechatH5Pay | Obrigatório |
| time | Long | Timestamp | Obrigatório |
- Parameters
| Parâmetro | Tipo | Descrição | Obrigatório |
|---|---|---|---|
| pay_method | String | online | Obrigatório |
| sub_pay_method | String | WeChat Pay | Obrigatório |
| order_id | String | ID do pedido do comerciante | Obrigatório |
| amount | String | Montante em formato de cadeia numérica. Por exemplo, introduza 24.99 para € 24.99. Montante em CNY >=1; montante em EUR >=0.1. | Obrigatório |
| currency | String | Código de moeda E, ISO 4217, como EUR ou CHF | Obrigatório |
| description | String | Descrição do pedido | Obrigatório |
| demo | String | Campo personalizado | Opcional |
| timeout | String | Tempo de expiração em minutos (0-1440) | Obrigatório |
| notify_url | String | URL de notificação assíncrona após o pagamento | Obrigatório |
| redirect_url | String | URL de redirecionamento após o pagamento | Opcional |
| ip_address | String | Endereço IP | Obrigatório |
Signature example:
Parâmetros ordenados e concatenados numa cadeia de consulta no formato de URL
"amount=0.1¤cy=EUR&demo=test&description=YabandPay test&ip_address=127.0.0.1&method=v3.CreatePaymentsWechatH5Pay¬ify_url=https://www.yabandpay.com/notify&order_id=202487816549841654&pay_method=online&redirect_url=https://www.yabandpay.com&sub_pay_method=WeChat Pay&time=1555498137&timeout=0&user=YOUR_CASHIER_UID"
Assine a stringA utilizando secret_key
A assinatura resultante é:
"YOUR_SIGNATURE"
Request example:
{
"user": "YOUR_CASHIER_UID",
"sign": "YOUR_SIGNATURE",
"method": "v3.CreatePaymentsWechatH5Pay",
"time": 1555498137,
"data": {
"amount": "0.1",
"currency": "EUR",
"demo": "test",
"description": "YabandPay test",
"notify_url": "https://www.yabandpay.com/notify",
"order_id": "YOUR_ORDER_ID",
"pay_method": "online",
"redirect_url": "https://www.yabandpay.com",
"sub_pay_method": "WeChat Pay",
"timeout": "0",
"ip_address" : "127.0.0.1"
}
}
Response example:
{
"status": true,
"code": "200",
"data": {
"order_id": "YOUR_ORDER_ID",
"trade_id": "ced03b0a-3bb1-ce9b-237e-eed85f4b7e33",
"amount": "0.10",
"currency": "EUR",
"parameters": {
"pay_url": "https://pay.yabandpay.com/payments/wechat_native_callback/order/M80d5a3f88dfb16716f04479e36dda8d79fbea0dc52cf8d902bd3330bb41"
},
"state": "processing"
},
"message": ""
}
Transmita o parâmetro pay_url à interface H5 correspondente para iniciar o WeChat Pay.
Additional information:
Response result:
-
Um pedido bem-sucedido devolve "status": true.
-
Um pedido mal-sucedido devolve "status": false.
Recomendamos vivamente utilizar Query Order e Asynchronous Notifications para manter os estados dos pagamentos corretos e atualizados.
Response codes:
| 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 |
