Order and display
The server calls the unified order endpoint with merchant number, appid, merchant order number, amount and description, setting trade_type to NATIVE. The returned code_url is a weixin:// string, not an image URL.
The front end turns code_url into a QR image and polls your own order status. Never rely on the browser to decide that payment succeeded.
Expiry and duplicate orders
code_url has a limited lifetime. The page needs a refresh action that places a new order, using a new merchant order number or closing the previous one first, otherwise you hit a duplicate order number error.
The amount must be decided server-side. Accepting an amount from the client means someone can pay one cent for a large order.
Callbacks and reconciliation
On success WeChat calls notify_url. Verify the signature, apply idempotent processing, update the order, then return success. If the callback is missing, query the order instead of leaving it pending forever.
Run a daily reconciliation against the platform bill. The differences are the only items that need human attention.
FAQ
Does Native payment work in a mobile browser?
It can display a QR code, but users cannot scan their own screen. Use H5 or JSAPI on mobile.
Can code_url be stored and reused?
No. After expiry the scan fails, so a fresh order is required.
What if the customer never pays?
The order stays open. Implement a timeout that calls the close-order endpoint so inventory and order numbers are released.
Related questions
Further reading
- WeChat Pay Merchant Setup Service details
- Debugging WeChat Pay Callbacks: Did the Request Arrive
- What Are the Common API Configuration Errors in Official Account Development? A Checklist Approach
- What to Do When Alipay Merchant Setup Documents Are Rejected? Correction Tips and Document Checklist
- Why WeChat Pay Settlements Get Delayed: Checking Order, Records and Bank Side
Sources & References
The following are public sources. Always check the latest requirements on the official authority or platform page.
