General

The WeChatPay service supports two actions: Pay and Refund.

Important note.

This service is 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). It will not initiate the WeChat app.

- When performing a transaction API call without 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. WeChatPay will not be available in the list to mobile users.

Pay

The Pay action can be used to perform a payment.

View in playground

Request


JSON Gateway request

Locale

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.

JSON

copy
{
   "Currency": "EUR",
   "AmountDebit": 10,
   "Invoice": "Testinvoice 1234",
   "Services": {
      "ServiceList": [
         {
            "Name": "WeChatPay",
            "Action": "Pay",
            "Parameters": [
               {
                  "Name": "Locale",
                  "Value": "en-US"
               }
            ]
         }
      ]
   }
}

Response


JSON gateway response

The response contains two URL's; 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 intiate the WeChat app, making this payment option not applicable for mobile payments.

QrCodeUrl

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

ID that will be shown on the customer’s bank statement.

expirytimestamp

Timestamp that shows when the WeChat Pay QR code will no longer be valid.

JSON

copy
{
   "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"
}

Push


JSON push response

After successful completion of the payment by the customer, a push response will follow with the final transaction status.

QrCodeUrl

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

The amount that has been paid in the consumer's currency.

ConsumerCurrency

The currency in which the payment has been done.

JSON

copy
{
   "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.

View in playground

Request


JSON gateway request

JSON

copy
{
   "Currency": "EUR",
   "AmountCredit": 0.01,
   "Invoice": "testinvoice 1234",
   "OriginalTransactionKey": "9D2C9F2938E24B7D8A3165F7BDA4Exxx",
   "Services": {
      "ServiceList": [
         {
            "Name": "wechatpay",
            "Action": "refund"
         }
      ]
   }
}

Response


JSON gateway response

JSON

copy
{
   "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"
}

Push


JSON push response

JSON

copy
{
   "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
   }
}