Requests
WeChatPay Service Guide
The WeChatPay service supports two primary actions: Pay and Refund.
Service Codes and Actions
- Actions: Pay, Refund
Important Notes
- Not Applicable for Mobile Payments:
- When performing a WeChat API call, a QR code will be displayed to the customer through the returned RedirectURL (on both desktop and mobile devices). This process will not initiate the WeChat app.
- When performing a transaction API call without a specified payment method, a RedirectURL will be returned to redirect the customer to the Buckaroo Payment Page where a list of available payment methods will be displayed. Note that WeChatPay will not be available in the list for mobile users.
Pay
The Pay action can be used to perform a payment.
Base JSON Request
Use the base request as instructed on this page.
Pay Request Parameters
Parameter | Type | Required | Recommended | Description |
---|---|---|---|---|
Locale | String | Possible values: en-US, zh-CN, zh-TW. Determines the displayed language for the customer. If the parameter is not provided, the language is English (default). Suggestion for implementation: use the billing address in the order information. If the billing country is China, send value zh-CN. If the billing country is Taiwan, send value zh-TW. Anything else, send value en-US. Another option is to check the customer's browser language. |
Example Request
{
"Currency": "EUR",
"AmountDebit": 10,
"Invoice": "Testinvoice 1234",
"Services": {
"ServiceList": [
{
"Name": "WeChatPay",
"Action": "Pay",
"Parameters": [
{
"Name": "Locale",
"Value": "en-US"
}
]
}
]
}
}
Pay Response
The response contains two URLs: the RedirectURL
and the QrCodeUrl
. In general, the consumer should be redirected to the RedirectURL
; a QR code will then be displayed to the customer to complete the payment. For mobile devices, this will not initiate the WeChat app, making this payment option not applicable for mobile payments.
Pay Response Parameters
Parameter | Type | Required | Recommended | Description |
---|---|---|---|---|
QrCodeUrl | String | The QrCodeUrl can be used for displaying the QR code on POS devices. But in general (for e-commerce transactions), the RedirectURL should be used to redirect the customer. | ||
BankStatementId | String | ID that will be shown on the customerβs bank statement. | ||
expirytimestamp | String | Timestamp that shows when the WeChat Pay QR code will no longer be valid. |
Example Response
{
"Key": "79FF157971FD401B8BD50952E09EXXXX",
"Status": {
"Code": {
"Code": 791,
"Description": "Pending processing"
},
"SubCode": {
"Code": "S002",
"Description": "An additional action is required: Redirect to WeChatPay."
},
"DateTime": "2019-10-18T13:07:12"
},
"RequiredAction": {
"RedirectURL": "https://testcheckout.buckaroo.nl/html/redirect.ashx?r=465007051FE74DD2B323AFCCAC2AXXXX",
"RequestedInformation": null,
"PayRemainderDetails": null,
"Name": "Redirect",
"TypeDeprecated": 0
},
"Services": [
{
"Name": "WeChatPay",
"Action": null,
"Parameters": [
{
"Name": "expirytimestamp",
"Value": "1571404000"
},
{
"Name": "BankStatementId",
"Value": "3E154AA"
},
{
"Name": "QrCodeUrl",
"Value": "weixin://wxpay/bizpayurl?pr=LOqdxxx"
}
]
}
],
"CustomParameters": null,
"AdditionalParameters": null,
"RequestErrors": null,
"Invoice": "Testinvoice 1234",
"ServiceCode": "WeChatPay",
"IsTest": true,
"Currency": "EUR",
"AmountDebit": 10,
"TransactionType": "C050",
"MutationType": 1,
"RelatedTransactions": null,
"ConsumerMessage": null,
"Order": null,
"IssuingCountry": null,
"StartRecurrent": false,
"Recurring": false,
"CustomerName": null,
"PayerHash": null,
"PaymentKey": "57FBEE1B06DE41B0ACBDED6B6A44XXXX"
}
Pay Push
After successful completion of the payment by the customer, a push response will follow with the final transaction status.
Pay Push Parameters
Parameter | Type | Required | Recommended | Description |
---|---|---|---|---|
QrCodeUrl | String | The QrCodeUrl can be used for displaying it on POS devices. But in general (for e-commerce transactions), the RedirectURL should be used to redirect the customer. | ||
ConsumerAmount | Decimal | The amount that has been paid in the consumer's currency. | ||
ConsumerCurrency | String | The currency in which the payment has been done. |
Example Push
{
"Transaction": {
"Key": "9D2C9F2938E24B7D8A3165F7BDA4XXXX",
"Invoice": "Testinvoice 1234",
"ServiceCode": "WeChatPay",
"Status": {
"Code": {
"Code": 190,
"Description": "Success"
},
"SubCode": {
"Code": "S990",
"Description": "The request was successful."
},
"DateTime": "2019-08-07T12:30:13"
},
"IsTest": true,
"Order": null,
"Currency": "EUR",
"AmountDebit": 0.01,
"TransactionType": "C050",
"Services": [
{
"Name": "WeChatPay",
"Action": null,
"Parameters": [
{
"Name": "QrCodeUrl",
"Value": "weixin://wxpay/bizpayurl?pr=XYZXXXX"
},
{
"Name": "ConsumerAmount",
"Value": "7"
},
{
"Name": "ConsumerCurrency",
"Value": "CNY"
}
],
"VersionAsProperty": 1
}
],
"CustomParameters": null,
"AdditionalParameters": null,
"MutationType": 1,
"RelatedTransactions": null,
"IsCancelable": false,
"IssuingCountry": null,
"StartRecurrent": false,
"Recurring": false,
"CustomerName": null,
"PayerHash": null,
"PaymentKey": "1EAB3CFDE6914B01BD8A7C4B8EAFXXXX"
}
}
Refund
This action can be used to perform a refund on a WeChatPay transaction.
Base JSON Request
Use the base request as instructed on this page.
Refund Request Parameters
Example Request
{
"Currency": "EUR",
"AmountCredit": 0.01,
"Invoice": "testinvoice 1234",
"OriginalTransactionKey": "9D2C9F2938E24B7D8A3165F7BDA4Exxx",
"Services": {
"ServiceList": [
{
"Name": "wechatpay",
"Action": "refund"
}
]
}
}
Refund Response Parameters
Example Response
{
"Key": "B4A21C5F70A940088EA85A6E5BBBAxxx",
"Status": {
"Code": {
"Code": 190,
"Description": "Success"
},
"SubCode": {
"Code": "S990",
"Description": "The request was successful."
},
"DateTime": "2019-08-21T16:20:28"
},
"RequiredAction": null,
"Services": null,
"CustomParameters": null,
"AdditionalParameters": null,
"RequestErrors": null,
"Invoice": "testinvoice 1234",
"ServiceCode": "WeChatPay",
"IsTest": true,
"Currency": "EUR",
"AmountCredit": 0.01,
"TransactionType": "C051",
"MutationType": 1,
"RelatedTransactions": [
{
"RelationType": "refund",
"RelatedTransactionKey": "9D2C9F2938E24B7D8A3165F7BDA4Exxx"
}
],
"ConsumerMessage": null,
"Order": null,
"IssuingCountry": null,
"StartRecurrent": false,
"Recurring": false,
"CustomerName": null,
"PayerHash": null,
"PaymentKey": "A7192A3231CE48AF8003317758838xxx"
}
Refund Push
Example Push
{
"Transaction": {
"Key": "B4A21C5F70A940088EA85A6E5BBBAxxx",
"Invoice": "testinvoice 1234",
"ServiceCode": "WeChatPay",
"Status": {
"Code": {
"Code": 190,
"Description": "Success"
},
"SubCode": null,
"DateTime": "2019-08-21T16:20:28"
},
"IsTest": true,
"Order": null,
"Currency": "EUR",
"AmountCredit": 0.01,
"TransactionType": "C051",
"Services": null,
"CustomParameters": null,
"AdditionalParameters": null,
"MutationType": 1,
"RelatedTransactions": [
{
"RelationType": "refund",
"RelatedTransactionKey": "9D2C9F2938E24B7D8A3165F7BDA4Exxx"
}
],
"IsCancelable": false,
"IssuingCountry": null,
"StartRecurrent": false,
"Recurring": false,
"CustomerName": null,
"PayerHash": null,
"PaymentKey": null
}
}
Updated about 2 months ago