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

  1. On the merchant checkout page, the consumer chooses to pay with WeChat Pay.
  2. The merchant/PSP sends PPRO a payment request.
  3. PPRO sends the payment request to WeChat.
  4. WeChat returns a QR code.
  5. The merchant displays the QR code on the PPRO-hosted payment page.
  6. The consumer scans the QR code with their WeChat app.
  7. They confirm the transaction and enter their payment password.
  8. A successful payment message is displayed.

Specific input parameters

Field NameM/O/CTypeRegexDescription
specin.localeOasciiN/ALocale 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 nameTypeDescription
SPECOUT.SRCAMOUNTasciiThe 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.SRCCURRENCYasciiThe currency of the consumer's WeChat wallet.

Only emitted when a transaction has been successfully paid.
SPECOUT.QRCODEURLasciiThe 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.EXPIRYTIMESTAMPasciiThe 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.SETTLEMENTCURRENCYasciiThe settlement currency of the transaction. Only emitted when a transaction has been successfully paid.
SPECOUT.SETTLEMENTAMOUNTasciiThe amount in the settlement currency of the transaction. Only emitted when a transaction has been successfully paid.
SPECOUT.FXRATEasciiThe 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 nameTypeDescription
SPECOUT.DSTAMOUNTasciiTotal amount in the minor unit of the consumer wallet currency (see also SPECOUT.DSTCURRENCY)
SPECOUT.DSTCURRENCYasciiThe currency of the consumer’s WeChat wallet (usually CNY)
SPECOUT.SETTLEMENTCURRENCYasciiThe settlement currency of the refund.
SPECOUT.SETTLEMENTAMOUNTasciiThe amount in the settlement currency of the refund.
SPECOUT.FXRATEasciiThe 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
&currency=EUR
&amount=1055
&merchanttxid=J2wkc3cdDaJS
&login=johndoe
&password=fsdfgsfer498^%wd
&contractid=JOHNDOECONTRACT
&channel=testchannel
&merchantredirecturl=https%3A%2F%2Fmerchant.com%2Fwork%2Fppro2%2Fhappylanding.php
&notificationurl=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.

ParameterCNY (settlement only available in EUR and USD)Like-for-like (processing and settlement in the same currency)
currency value in Transaction callCNYNon-CNY.

E.g: GBP
currency value in Refund callCNY

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=SUCCEEDEDThe predetermined non-CNY settlement currency

E.g. USD or EUR
The same value as the currency value in Transaction call

E.g. GBP
SPECOUT.SETTLEMENTCURRENCY in Refund API response upon STATUS=SUCCEEDEDThe predetermined non-CNY settlement currency

E.g. USD or EUR
The same value as the currency value in Transaction call

E.g. GBP
CURRENCY in settlement filesThe 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 request

E.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)

ParameterValue
tagwechatpay
currencyCNY
countrycodeCN
amount1000

Table 9. Succeeded Transaction response example (only key parameters)

ParameterDescriptionValue
SPECOUT.FXRATEExchange rate (used by WeChat Pay)

This exchange rate is guaranteed for potential refunds
6.44145000
SPECOUT.CNYAMOUNTThe amount deducted from the consumer’s wallet

In CNY major units
10.00
SPECOUT.SRCCURRENCYThe currency of the consumer’s walletCNY
SPECOUT.SRCAMOUNTThe amount deducted from the consumer’s wallet

In minor units, according to ISO 4217
1000
SPECOUT.SETTLEMENTCURRENCYThe settlement currency of the transactionUSD
SPECOUT.SETTLEMENTAMOUNTThe 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)

ParameterValue
tagwechatpay
currencyCNY
countrycodeCN
amount1000

Table 11. Succeeded Refund response example (only key parameters)

ParameterDescriptionValue
SPECOUT.FXRATEExchange rate (used by WeChat Pay)

This is the guaranteed rate from the initial transaction
6.44145000
SPECOUT.DSTCURRENCYThe currency of the consumer’s walletCNY
SPECOUT.DSTAMOUNTThe amount deducted from the consumer’s wallet

In minor units, according to ISO 4217
1000
SPECOUT.SETTLEMENTCURRENCYThe settlement currency of the transactionUSD
SPECOUT.SETTLEMENTAMOUNTSPECOUT.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_IDTX_IDPAYMENT_REFERENCEEVENT_TYPEEVENT_TIMESTAMPMERCHANT_IDPAYMENT_METHODAMOUNTCURRENCYCOUNTRY
2021061519991112223CPCKRASUCCEEDED2021-06-15T11:37:01ZTESTCONTRACTWeChatPay1.60USDCN

Only the converted amount (USD or EUR) will show in this file.

Table 13. Volume-per-refund settlement file

MERCHANT_TX_IDRF_IDPAYMENT_REFERENCEEVENT_TYPEEVENT_TIMESTAMPMERCHANT_IDPAYMENT_METHODAMOUNTCURRENCYCOUNTRYREFERENCE_TX_ID
2021061519991112223PZ0FWASUCCEEDED2021-06-15T15:16:02ZTESTCONTRACTWeChatPay-1.60USDCN999111222

Only the converted amount (USD or EUR) will show in this file.

Table 14. Aggregate settlement file

MERCHANT_IDPAYMENT_METHODEVENT_TYPEEVENT-COUNTAGGREGATE_AMOUNTCURRENCY
TESTCONTRACTWeChatPayTRANSACTION11.60USD
TESTCONTRACTWeChatPayREFUND1-1.60USD
TESTCONTRACTWeChatPayACQUIRING_FEE2-0.20USD
TESTCONTRACTWeChatPaySUCCEEDED_FEE2-0.20USD

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.