5.4 WECHAT

WeChat Pay is a payment feature integrated into the WeChat app, users can complete payment quickly with smartphones. WeChat has Quick Pay, QR Code Payments, In-App Web-Based Payments, and Native In-App Payments, all to fulfill the full range of scenarios your customers expect to fulfill different payment situations.

ScenarioCategoryPayment methodPayment productIntegration typeAuthenticationRedirect TypeCode TypePre-authPartial RefundCancellation supported
ONLINE/OFFLINEEwalletWECHATQR_CODE_PAYMENTAPI, POS--Order code-YES-
OFFLINEEwalletWECHATQUICK_PAYAPI, POS--Payment code-YES-
ONLINEEwalletWECHATINAPP_PAYMENTAPI-In-app--YES-
ONLINEEwalletWECHATOFFICIAL_ACCOUNT_PAYMENTAPI,EMVCO_QR-In-app--YES-
ONLINEEwalletWECHATMINI_PROGRAM_PAYMENTAPI-In-app--YES-
ONLINEEwalletWECHATWEB_PAYMENTAPI-In-app--YES-

Payment Product Description

QR_CODE_PAYMENT

Merchant-Presented Mode Payment product. WeChat's Payment product. QR_CODE_PAYMENT is applicable to both online and offline scenarios. One code value can only be used for one transaction. For example, the order code displayed on the merchant's terminal screen or printed on the cashier's receipt. After the user scans the code, the user usually does not need to enter the transaction amount to initiate the payment.

QUICK_PAY

User-Presented Mode Payment product.T he WeChat Pay user opens the WeChat client and selects + in the top right corner > Money or Me > Services > Money to show the payment code. The merchant uses a code scanning device to scan the payment code and complete the deduction.

INAPP_PAYMENT

Payment product. In-App Payment means that the WeChat Pay user selects goods and places orders in the merchant's App, and selects WeChat Pay at the payment stage. Then the WeChat client will be pulled up from the merchant's App, and the system will automatically redirect back to the merchant's App after the user completes the payment in the WeChat client.
In-App Payment is a payment product more inclined to online scenarios, and often used for online retailers, catering takeout, etc.

OFFICIAL_ACCOUNT_PAYMENT

Payment product. It refers to the payment capability of the user in opening the merchant's H5 page in the WeChat client and pulling up the WeChat Pay cash register on the H5 page to complete the payment.
The payment capability of official account is a product capability based on the H5 page of the WeChat client, with multiple characteristics such as flexible product capability, multiple application modes, low development cost, and close connection with the WeChat ecosystem. It can be used in both online and offline scenarios.

MINI_PROGRAM_PAYMENT

Payment product. Pay by Mini Program means that merchants provide goods or services for users through WeChat Pay mini programs, and users complete payment through WeChat Pay in the WeChat Pay mini programs.

WEB_PAYMENT

Payment product. It refers to the payment capability that the merchant displays goods or services on the mobile Web page outside the WeChat client. When the user confirms using WeChat Pay on the above page, the merchant initiates H5 payment to call the WeChat client, and the user completes the payment on the WeChat client.
The capability applies to the payment scenario where WeChat Pay needs to be called up when users open the merchant's H5 mall website for shopping in the browser outside the WeChat client (e.g., the QQ browser, Google browser, or Safari).

Experience and integration process

CapabilitiesAPIsDescription
Initiate a paymentPAY
Refund a paymentREFUND
Inquiry transaction resultDETAIL
Notify transaction resultNOTIFICATION

Initiate a payment

Field Description Required

paymentMethod

Must be "WECHAT"

M

product

For QUICK_PAY, it must be "QUICK_PAY";
For OFFICIAL_ACCOUNT_PAYMENT, it must be "OFFICIAL_ACCOUNT_PAYMENT";
For IN_APP_PAYMENT, it must be "IN_APP_PAYMENT";
For MINI_PROGRAM_PAYMENT, it must be "MINI_PROGRAM_PAYMENT";
For WEB_PAYMENT, it must be "WEB_PAYMENT"
For QR code, it must be "QR_CODE_PAYMENT"

M

expireAt

The format is "yyyy-MM-dd hh:mm:ss", and it must be less than 72 hours after the payment request is sent.
It's required when the product is "QR_CODE_PAYMENT"

C

payCodeValue

It's required when the product is "QUICK_PAY"

C

openId

It's required when the product is "OFFICIAL_ACCOUNT_PAYMENT", "IN_APP_PAYMENT", "MINI_PROGRAM_PAYMENT"

C

goods.description

It's required when paymentMethod is WECHAT

M

Handle the payment result To complete the payment:

  • OFFICIAL_ACCOUNT_PAYMENT, MINI_PROGRAM_PAYMENT
  1. Pass the values prepayid in the(payAction, "type": "REDIRECT", "Url") object to the WeChat Pay SDK. The WeChat Pay SDK launches the WeChat app, where the shopper can proceed to complete the payment. The value is valid for 2 hours.
  2. Use the data.status from the PAY response to present the payment result to your shopper. You can also wait the NOTIFICATION or submit a DETAIL request for the payment result.
  • QR_CODE_PAYMENT
  1. Present the QR code image(payAction, "type": "QRCODE", "redirectUrl") to the shopper for scanning.
  2. After the shopper completes the payment, wait the NOTIFICATION or submit a DETAIL request for the payment result.
  • PAYMENT_CODE
  1. Use the data.status from the PAY response to present the payment result to your shopper. You can also wait the NOTIFICATION or submit a DETAIL request for the payment result.
  • WEB_PAYMENT
  1. Redirect shopper(payAction, "type": "REDIRECT", "Url") to call the WeChat Pay cashier. Call the WeChat client by visiting the URL to complete the payment. The validity period of Url is 5 minutes.