WeChat Pay Configuration Guide
WeChat Pay is the most popular payment method in China, supporting QR code payment, public account payment, mini program payment and other payment scenarios.
Prerequisites
Register WeChat Merchant Platform
Visit WeChat Pay Merchant Platform (pay.weixin.qq.com), register and complete enterprise verification to get Merchant ID (mch_id).
Get AppID
Log in to WeChat Public Platform or WeChat Open Platform, get AppID in 'Development' -> 'Basic Configuration'.
Set APIv3 Key
Set 32-character APIv3 key in Merchant Platform 'Account Center' -> 'API Security'.
Apply for Merchant API Certificate
Download certificate tool to generate certificate, get apiclient_key.pem private key file and certificate serial number.
Configuration Steps
Step 1: Enter Payment Platform Management
In admin panel, go to 'System Settings' -> 'Payment Platform Management', find WeChat Pay configuration item.
Step 2: Fill in Basic Information
Fill in AppID, Merchant ID, Certificate Serial Number and other basic information.
Step 3: Upload Certificate File
Paste the private key file apiclient_key.pem content into configuration, or upload the certificate file.
Step 4: Configure Callback URL
Set payment callback URL, format: https://yourdomain.com/api/v1/webhook/recharge/notify/wechat
Step 5: Save and Test
After saving configuration, use a small amount order to test if payment process works normally.
Notes
- Callback URL must use HTTPS
- Certificate files should be kept safe, do not leak
- APIv3 key is a 32-character string, recommend using random generation
- Production environment needs to configure callback URL whitelist in merchant platform
FAQ
Where to view certificate serial number?
Use OpenSSL command: openssl x509 -in apiclient_cert.pem -noout -serial, or view in merchant platform API security page.
Payment callback failed?
Check if callback URL is HTTPS, publicly accessible, and firewall allows it.
Signature verification failed?
Confirm APIv3 key is correct, private key file path is correct, private key file format is PEM.