Confirm the signing first
In the Alipay open platform, the application must have the mini program payment capability signed. Without it, calls return a permission error that is often vague.
The application type matters: mini program applications and web or mobile applications are different entry points. Using a web application appid to launch mini program payment fails.
Key order parameters
out_trade_no is generated by the merchant and must be globally unique. total_amount is a string in yuan with two decimals. buyer_id normally comes from the login state; omitting it can leave the trade unattributed.
product_code must match the signed product. A wrong value produces the confusing case where the order is created but cannot be paid.
Client-side notes
my.tradePay only works inside the Alipay client. Testing in a browser always fails; use a device or the mini program simulator.
Treat the asynchronous notification as authoritative. The client callback is for navigation only and must not trigger fulfilment.
FAQ
Can mini program and mobile web payments share code?
The endpoints differ. Mini programs use trade.create plus my.tradePay; mobile web uses trade.wap.pay and returns a payment URL.
Can total_amount be numeric?
It must be a string with two decimals. Numeric values can serialise to scientific notation and break the order.
Payment succeeded but no notification arrived. What now?
Query the trade status and process if successful. Also check that notify_url is publicly reachable and returns success.
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.
