Skip to main content
Wechat Jsapi Process
This payment method must be initiated inside the WeChat in-app browser.
It will NOT work in external browsers such as Chrome or Safari.

Overview

WeChat JSAPI enables payments inside an Official Account web page viewed within WeChat. This method is ideal for:
  • Official Account H5 stores
  • In-app service flows
  • QR campaigns opening inside WeChat
For merchants in Canada, refer to
Alipay Web Payments
where pay_type = 800207.

Integration Methods

Method 1 — Merchant’s Own Official Account

Merchants use their verified WeChat Official Account. Requirements
  1. Official Account verified & linked to QFPay
  2. Obtain user openid
  3. Domain added to JSAPI whitelist
Resources:

Method 2 — QFPay Official Account (Indirect Settlement)

For merchants without a verified account, QFPay provides an Official Account.

Payment Flow Overview

  1. User opens payment page inside WeChat
  2. Retrieve OAuth code
  3. Exchange code → obtain openid
  4. Submit payment request
  5. Redirect to WeChat JSAPI payment module
  6. Verify payment result via backend

Step 1 — Obtain WeChat OAuth Code

Request GET /tool/v1/get_weixin_oauth_code
This endpoint must be opened inside WeChat.
app_code and sign must be sent as query parameters, not headers.

Parameters

Response
Redirect the user to the returned URL.

Step 2 — Exchange Code for openid

Request GET /tool/v1/get_weixin_openid

Parameters

Headers required:
  • X-QF-APPCODE
  • X-QF-SIGN
Response
A new OAuth code and openid must be obtained for each payment attempt.
Do not cache or reuse.

Step 3 — Submit Payment Request

Endpoint POST /trade/v1/payment PayType: 800207 (WeChat JSAPI)

Required Fields

Refer to:

pay_params Response


Step 4 — Redirect to WeChat Payment Module

Redirect the user’s browser to: GET https://o2-hk.qfapi.com/q/direct

Required Parameters

This request is sent directly from the user’s browser.
No authentication headers are required.

Additional Notes

  • JSAPI flow must be executed sequentially
  • Do not reuse OAuth codes or openid
  • If payment result is delayed, verify via
    Transaction Enquiry API
  • Real-name verification is optional and depends on merchant configuration