Skip to main content

Overview​

WeChat Pay direct integration supports only the following payment methods: PC QR code payment, Mini Program payment, and in-app payment. Merchants should set the methods parameter based on the payment scenario and handle the API response accordingly.

For all WeChat Pay payment scenarios, see the WeChat Pay integration guide.

Flowchart​

Request​

The merchant’s server submits the required parameters using direct integration:

ScenarioDescriptionPayment (methods)[/docs/payment/parameter#request-parameters] value
PC QR Code PaymentOpens in a desktop browser. The merchant generates a QR code for the user to scan and pay.WeChatPay_Web
cURL -X POST 'https://test-secure.oceanpayment.com/gateway/directservice/pay'
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'account=995149' \
-d 'terminal=99514901' \
-d 'signValue=6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' \
-d 'backUrl=https://www.abc.com/back.php' \
-d 'noticeUrl=https://www.abc.com/notice.php' \
-d 'order_number=NO12345678' \
-d 'order_currency=HKD' \
-d 'order_amount=0.01' \
-d 'methods=WeChatPay_Web' \
-d 'order_notes=' \
-d 'billing_firstName=test' \
-d 'billing_lastName=test' \
-d 'billing_email=test@gmail.com' \
-d 'billing_phone=13800138000' \
-d 'billing_country=HK' \
-d 'billing_state=HK' \
-d 'billing_city=Washington D.C.' \
-d 'billing_address=705A big Road' \
-d 'billing_zip=529012' \
-d 'billing_ip=127.0.0.1' \
-d 'productNum=1' \
-d 'productName=Red Dress' \
-d 'productSku=#001' \
-d 'productPrice=0.01' \

Response​

See the full list of response parameters.

<?xml version="1.0" encoding="UTF-8"?>
<response>
<notice_type>transaction</notice_type>
<push_dateTime>2026-11-12 07:25:57</push_dateTime>
<account>995149</account>
<terminal>99514901</terminal>
<signValue>41FE077BA389DB90DEF5EEC70AB2C401D7027D6940F1203700FBAE3CB116BB42</signValue>
<methods>WeChatPay_Web</methods>
<order_number>NO12345678</order_number>
<card_country></card_country>
<order_currency>HKD</order_currency>
<order_amount>0.01</order_amount>
<order_notes></order_notes>
<card_number></card_number>
<card_type></card_type>
<payment_country>HK</payment_country>
<payment_id>231219095247018026021</payment_id>
<payment_authType>0</payment_authType>
<payment_status>-1</payment_status>
<payment_details>80700:Transaction was not finished</payment_details>
<payment_solutions></payment_solutions>
<payment_risk></payment_risk>
<payment_amount></payment_amount>
<payment_exchangeRate></payment_exchangeRate>
<pay_barCode>weixin://wxpay/bizpayurl?pr=158DR2T159DS2F1U</pay_barCode>
<pay_userId></pay_userId>
<payment_transactionNetworkId></payment_transactionNetworkId>
<payment_transactionLinkId></payment_transactionLinkId>
</response>
  1. Order status: When payment_status = -1, the order is pending. The merchant should retrieve the WeChat QR code parameter pay_barCode and generate a QR code on the payment page for the user to scan and pay.
  2. QR code generation example
  • Use the frontend qrcode package to generate the QR code.
npm install qrcode
  • Pass the complete pay_barCode value directly to the QR code generator. After generating the QR code, scan it with WeChat to verify it.
import QRCode from 'qrcode';

const payUrl = 'weixin://wxpay/bizpayurl?pr=158DR2T159DS2F1U';
QRCode.toCanvas(document.getElementById('qrcode'), payUrl, (error) => {
if (error) console.error('QR code generation failed.', error);
});
  • Add the following to the page:
<canvas id="qrcode"></canvas>

Payment Status​

See Payment Status for details.

Asynchronous Notification​

You also need to receive the transaction’s asynchronous notification via noticeUrl.

Signature​

See Signature Generation and Verification for details.