WeChat Pay
Step 1. Preparation
First, you need to have a merchant account at WeChat Merchant Platform.
Before accessing the WeChat Pay, there are some preparations that need to be done.
You can refer to the documentation preparation before access for more information.
1.1 Get API Key v3
Log in to WeChat Merchant Platform, select Account Settings > API Security >Set APIv3 Secret
, and click Set APIv3 secret
to get the API Key v3
.
How to get API Key v3
: APIv3 Key Settings
1.2 Get Merchant Certificate
You can log in to WeChat Merchant Platform, and select Account Settings > API Security > API Certificate
to download the certificate.
After download the certificate, get the Certificate Serial Number
according to How to view the Certificate Serial Number and Private Key
according to How to get Private Key of Certificate.
Then, create a Cert
at Casdoor and fill the necessary information.
1.3 Get Merchant ID and App ID
How to get Merchant ID
: WeChat Pay Merchant ID Query Guide
How to get App ID
: WeChat Pay APPID Query Guide
Step 2. Create a WeChat Pay Payment provider
Next, create a WeChat Pay Payment provider in Casdoor by filling in the necessary information.
Name | Name in WeChat Pay |
---|---|
Category | choose Payment |
Type | choose WeChat Pay |
Client ID | Merchant ID obtained from Step 1.3 |
Client secret | API Key v3 obtained from Step 1.1 |
App ID | App ID obtained from Step 1.3 |
Cert | Cert configured at Step 1.2 |
Step 3. Add the WeChat Pay Payment provider for your product
Finally, add the WeChat Pay Payment provider for your product so that users can purchase the product using WeChat Pay.
Support for JSAPI payment
Currently, Casdoor supports JSAPI payment and Native payment in WeChat Pay.
To support JSAPI payment, you should configure a WeChat OAuth Provider which support WeChat Media Platform
.
The Client ID 2
of WeChat OAuth Provider and the App ID
of WeChat Pay Payment Provider need to be same.
After log in via WeChat(in the mobile scenario: e.g. the WeChat built-in browser inside the WeChat mobile app), users can purchase product using WeChat Pay based on JSAPI payment.