General

The WeChatPay service supports two actions: Pay and Refund.

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 consumer. 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 consumer's browser language.

UseMobileView
Required

Boolean: true or false. It is important to identify if the consumer is on a mobile device or not. If yes, then send value true. This will enable the WeChatApp to be opened on the consumer's mobile device. If not, then send value false. The consumer will then be shown a QR code to scan.

JSON

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

Response


JSON gateway response

The response contains two URL's; the RedirectURL and the QrCodeUrl. The consumer should always be redirected to the RedirectURL.

QrCodeUrl

For now, the QrCodeUrl can be ignored. The consumer should always be redirected to the RedirectURL. From there either the WeChat app will be initiated on the consumer's device or a QR code will be shown, depending on the value given for UseMobileView.

JSON

copy
{
   "Key": "EB04E9DD601D4F879588876104C7Fxxx",
   "Status": {
      "Code": {
         "Code": 791,
         "Description": "Pending processing"
      },
      "SubCode": {
         "Code": "S002",
         "Description": "An additional action is required: Redirect to WeChatPay."
      },
      "DateTime": "2019-08-21T16:08:47"
   },
   "RequiredAction": {
      "RedirectURL": "https://testcheckout.buckaroo.nl/html/redirect.ashx?r=74C26136EA30494785379F529186Bxxx",
      "RequestedInformation": null,
      "PayRemainderDetails": null,
      "Name": "Redirect",
      "TypeDeprecated": 0
   },
   "Services": [
      {
         "Name": "WeChatPay",
         "Action": null,
         "Parameters": [
            {
               "Name": "QrCodeUrl",
               "Value": "weixin://wxpay/bizpayurl?pr=XYZ1xxx"
            }
         ]
      }
   ],
   "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": "6F5AB4D4DF3D4770A1D7EB05E4ABFxxxF"
}

Push


JSON push response

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

QrCodeUrl

For now, the QrCodeUrl can be ignored. The consumer should always be redirected to the RedirectURL. From there either the WeChat app will be initiated or a QR code will be shown, depending on the value given for UseMobileView.

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": "9D2C9F2938E24B7D8A3165F7BDA4E197",
      "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=XYZ1234"
               },
               {
                  "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": "1EAB3CFDE6914B01BD8A7C4B8EAF2972"
   }
}

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
   }
}