WeChat Pay Online
WeChat Pay Online is the flow where the merchant generates a QR code on their website and the consumer scans it.
Transaction Flow
- On the merchant checkout page, the consumer chooses to pay with WeChat Pay.
- The merchant/PSP sends PPRO a payment request.
- PPRO sends the payment request to WeChat.
- WeChat returns a QR code.
- The merchant displays the QR code on the PPRO-hosted payment page.
- The consumer scans the QR code with their WeChat app.
- They confirm the transaction and enter their payment password.
- A successful payment message is displayed.
Specific input parameters
Field Name | M/O/C | Type | Regex | Description |
---|---|---|---|---|
specin.locale | O | ascii | N/A | Locale identifiers for the PPRO-hosted payment page. It is specified as Language-Region tags. Supported values: zh-CN (Simplified Chinese)zh-TW (Traditional Chinese)en-US (English, the default) |
For standard input parameters, see Input parameters for the TRANSACTION call.
Note
WeChat Pay Online is available for currencies EUR, GBP, CNY, CHF and USD.
This payment method supports the dynamic descriptor field (see The dynamic descriptor).
Specific output parameters
Specific output parameters for the TRANSACTION call
This payment method will emit the output parameters outlined below:
Field name | Type | Description |
---|---|---|
SPECOUT.SRCAMOUNT | ascii | The total amount debited from the consumer's WeChat Wallet. The currency of this amount is emitted in the separate specout (SPECOUT.SRCCURRENCY). Only emitted when a transaction has been successfully paid. |
SPECOUT.SRCCURRENCY | ascii | The currency of the consumer's WeChat wallet. Only emitted when a transaction has been successfully paid. |
SPECOUT.QRCODEURL | ascii | The string used for generating the payment QR code image. It contains a unique URL starting with weixin:// . Used for placing a QR code directly on a website, without redirect to PPRO. Only emitted after successful transaction initialization.For more details, see the "You host the barcode" section below. |
SPECOUT.EXPIRYTIMESTAMP | ascii | The expiry time of the transaction. A future time defined as UNIX timestamp (seconds elapsed since 1970-01-01 00:00:00 UTC). Only emitted after a successful transaction initialization. Example: 1574869035 is the UNIX timestamp for Wednesday, 2019-11-19 15:37:15 UTC |
SPECOUT.SETTLEMENTCURRENCY | ascii | The settlement currency of the transaction. Only emitted when a transaction has been successfully paid. |
SPECOUT.SETTLEMENTAMOUNT | ascii | The amount in the settlement currency of the transaction. Only emitted when a transaction has been successfully paid. |
SPECOUT.FXRATE | ascii | The exchange rate. Only emitted when a transaction has been successfully paid. For example: USD/CNY = 6.59430000 |
For standard output parameters, check Output parameters for the TRANSACTION call.
Specific output parameters for the REFUND call
Field name | Type | Description |
---|---|---|
SPECOUT.DSTAMOUNT | ascii | Total amount in the minor unit of the consumer wallet currency (see also SPECOUT.DSTCURRENCY ) |
SPECOUT.DSTCURRENCY | ascii | The currency of the consumer’s WeChat wallet (usually CNY) |
SPECOUT.SETTLEMENTCURRENCY | ascii | The settlement currency of the refund. |
SPECOUT.SETTLEMENTAMOUNT | ascii | The amount in the settlement currency of the refund. |
SPECOUT.FXRATE | ascii | The refund exchange rate. The same exchange rate used for the transaction. For example: USD/CNY = 6.59430000 |
TRANSACTION call input
tag=wechatpay
&txtype=TRANSACTION
&countrycode=CN
¤cy=EUR
&amount=1055
&merchanttxid=J2wkc3cdDaJS
&login=johndoe
&password=fsdfgsfer498^%wd
&contractid=JOHNDOECONTRACT
&channel=testchannel
&merchantredirecturl=https%3A%2F%2Fmerchant.com%2Fwork%2Fppro2%2Fhappylanding.php
¬ificationurl=https%3A%2F%2Fmerchant.com%2Fwork%2Fppro2%2Fnotification.php
&specin.dynamicdescriptor=DynDescriptor
&specin.locale=zh-CN
&accountholdername=John%20Doe
&returnmode=urlencodeext
TRANSACTION call output
REQUESTSTATUS=SUCCEEDED
&STATUS=SUCCEEDED
&TXID=881495832
&ERRMSG=
&CHANNEL=testchannel
&TAG=wechatpay
&REDIRECTSECRET=1O2jLKHsCxaHejbQuCOR6nIFpaXKi343
&SPECOUT_EXPIRYTIMESTAMP=1618842495
&SPECOUT_PAYMENTPURPOSE=2LUPW10 DynDescriptor
&SPECOUT_QRCODEURL=weixin://wxpay/bizpayurl?pr=abcdefg
&SPECOUT_SRCAMOUNT=8274
&SPECOUT_SRCCURRENCY=CNY
&SPECOUT.FXRATE:6.59430000
&SPECOUT.SETTLEMENTAMOUNT: 15
&SPECOUT.SETTLEMENTCURRENCY: EUR
Additional Information
Notes on CNY Processing
All transactions processed in CNY are settled in USD or EUR. Alipay applies a foreign exchange rate per transaction and settles to us the converted amount in the predetermined settlement currency (USD or EUR). We also settle with you the converted amounts. This means you must track the foreign exchange rate per transaction for reconciliation purposes into the settlement currency (USD or EUR). We provide the foreign exchange rate between CNY and the settlement currency in SPECOUT.FXRATE.
Refunds are handled similarly. The SPECOUT.FXRATE parameter tracks the amount that will be deducted from your settlement. The consumer never pays any foreign exchange costs in none of the cases above. In both cases, you handle the cost through the USD or EUR settlement.
The table below shows the differences between CNY versus like-for-like processing currency.
Parameter | CNY (settlement only available in EUR and USD) | Like-for-like (processing and settlement in the same currency) |
---|---|---|
currency value in Transaction call | CNY | Non-CNY. E.g: GBP |
currency value in Refund call | CNY The same value as the currency value in Transaction call | GBP The same value as the currency value in Transaction call |
SPECOUT.SETTLEMENTCURRENCY in Transaction call when STATUS=SUCCEEDED | The predetermined non-CNY settlement currency E.g. USD or EUR | The same value as the currency value in Transaction callE.g. GBP |
SPECOUT.SETTLEMENTCURRENCY in Refund API response upon STATUS=SUCCEEDED | The predetermined non-CNY settlement currency E.g. USD or EUR | The same value as the currency value in Transaction callE.g. GBP |
CURRENCY in settlement files | The predetermined non-CNY settlement currency E.g. USD or EUR Our settlement files will not show or track foreign exchange rates | The same value as the currency value in Transaction API requestE.g. GBP |
Examples
The example used below shows a WeChat Pay transaction with USD as the settlement currency.
Table 8. Transaction call example (only key parameters)
Parameter | Value |
---|---|
tag | wechatpay |
currency | CNY |
countrycode | CN |
amount | 1000 |
Table 9. Succeeded Transaction response example (only key parameters)
Parameter | Description | Value |
---|---|---|
SPECOUT.FXRATE | Exchange rate (used by WeChat Pay) This exchange rate is guaranteed for potential refunds | 6.44145000 |
SPECOUT.CNYAMOUNT | The amount deducted from the consumer’s wallet In CNY major units | 10.00 |
SPECOUT.SRCCURRENCY | The currency of the consumer’s wallet | CNY |
SPECOUT.SRCAMOUNT | The amount deducted from the consumer’s wallet In minor units, according to ISO 4217 | 1000 |
SPECOUT.SETTLEMENTCURRENCY | The settlement currency of the transaction | USD |
SPECOUT.SETTLEMENTAMOUNT | The amount in the settlement currency of the transaction (amount calculated by WeChat Pay and to be settled to you) In minor units according to ISO 4217 | 160 |
In the example above, the consumer will be billed CNY 10.00 and you will be settled USD 1.60.
Table 10. Refund call example (only key parameters)
Parameter | Value |
---|---|
tag | wechatpay |
currency | CNY |
countrycode | CN |
amount | 1000 |
Table 11. Succeeded Refund response example (only key parameters)
Parameter | Description | Value |
---|---|---|
SPECOUT.FXRATE | Exchange rate (used by WeChat Pay) This is the guaranteed rate from the initial transaction | 6.44145000 |
SPECOUT.DSTCURRENCY | The currency of the consumer’s wallet | CNY |
SPECOUT.DSTAMOUNT | The amount deducted from the consumer’s wallet In minor units, according to ISO 4217 | 1000 |
SPECOUT.SETTLEMENTCURRENCY | The settlement currency of the transaction | USD |
SPECOUT.SETTLEMENTAMOUNT | SPECOUT.SETTLEMENTAMOUNT The amount in the settlement currency of the refund (amount calculated by WeChat Pay and to be settled to you) In minor units according to ISO 4217 | 160 |
In the sample above, the consumer will be refunded CNY 10.00; you will be debited USD 1.60.
Settlement file examples
Table 12. Volume-per-transaction settlement file
MERCHANT_TX_ID | TX_ID | PAYMENT_REFERENCE | EVENT_TYPE | EVENT_TIMESTAMP | MERCHANT_ID | PAYMENT_METHOD | AMOUNT | CURRENCY | COUNTRY |
---|---|---|---|---|---|---|---|---|---|
202106151 | 999111222 | 3CPCKRA | SUCCEEDED | 2021-06-15T11:37:01Z | TESTCONTRACT | WeChatPay | 1.60 | USD | CN |
Only the converted amount (USD or EUR) will show in this file.
Table 13. Volume-per-refund settlement file
MERCHANT_TX_ID | RF_ID | PAYMENT_REFERENCE | EVENT_TYPE | EVENT_TIMESTAMP | MERCHANT_ID | PAYMENT_METHOD | AMOUNT | CURRENCY | COUNTRY | REFERENCE_TX_ID |
---|---|---|---|---|---|---|---|---|---|---|
202106151 | 999111222 | 3PZ0FWA | SUCCEEDED | 2021-06-15T15:16:02Z | TESTCONTRACT | WeChatPay | -1.60 | USD | CN | 999111222 |
Only the converted amount (USD or EUR) will show in this file.
Table 14. Aggregate settlement file
MERCHANT_ID | PAYMENT_METHOD | EVENT_TYPE | EVENT-COUNT | AGGREGATE_AMOUNT | CURRENCY |
---|---|---|---|---|---|
TESTCONTRACT | WeChatPay | TRANSACTION | 1 | 1.60 | USD |
TESTCONTRACT | WeChatPay | REFUND | 1 | -1.60 | USD |
TESTCONTRACT | WeChatPay | ACQUIRING_FEE | 2 | -0.20 | USD |
TESTCONTRACT | WeChatPay | SUCCEEDED_FEE | 2 | -0.20 | USD |
Only the converted amount (USD or EUR) will show in this file.
Payment Scenarios
PPRO hosts the QR code
In this scenario, you don't build the logic to render a QR code. You also don't handle the additional logic to redirect the consumer based on a payment success notification from PPRO.
We assume the consumer uses a desktop/laptop/tablet or other large-screen device and is redirected to the PPRO-hosted payment page (via the returned REDIRECTURL
).
The consumer can use the WeChat application on a mobile device to scan the payment QR code. The PPRO-hosted payment page automatically redirects the consumer back to the merchant website once the transaction is completed (via the merchantredirecturl
; see Specific input parameters for the TRANSACTION call).
You host the QR code
In this scenario, you or the end merchants build the logic to render a QR code. You also handle the additional logic to redirect the consumer based on a payment success notification from PPRO.
We assume the consumer uses a desktop/laptop/tablet or other large-screen device and sees the payment QR code you or the merchant generated via the SPECOUT.QRCODEURL
output parameter value. Optionally, you can use the SPECOUT.EXPIRYTIMESTAMP
output parameter value to indicate for how long the payment QR code will be valid. To drive consumer behavior appropriately, we recommend showing a running timer.
The consumer can use the WeChat application on a different mobile device to scan the payment QR code. After the consumer pays on their phone, PPRO will send you a notification on the transaction status change. You must inform the merchant and have the consumer redirected to a final landing page (for example, a "thank you" page).
Caution
Do not poll PPRO for transaction status. Wait for the notification of a status change as the trigger to take further action on the consumer's browser.
Updated about 1 year ago