Skip to main content

WeChatPay

Step1. Deploy Casdoor

Firstly, the Casdoor should be deployed.

You can refer to the Casdoor official documentation for the Server Installation. Please deploy your Casdoor instance in production mode.

After a successful deployment, you need to ensure:

  • Open your favorite browser and visit http://localhost:8000, you will see the login page of Casdoor.
  • Input admin and 123 to test login functionality is working fine.

Then you can quickly implement a casdoor based login page in your own app with the following steps.

Step2. Configure payment callback notification address

Before that, please log in to the WeChat Pay Merchant Platform. In order for Casdoor to receive payment result notifications, you need to set a callback notification address in the WeChat Pay Merchant Platform.

  • In Merchant Dashboard, go to Development Configuration -> Payment Configuration.
  • Find the Callback Notification Address setting, and click the Modify button.
  • Fill in the payment callback notification address of the Casdoor instance. For example:
https://your-casdoor-instance.com/api/wechat-payment-callback

Step3. Configure API Security

Get APIv3 key

To ensure the security of API calls, you need to configure API security settings in the WeChat Pay Merchant Platform.

Log in the WeChat merchant platform -> Account center -> Account settings -> API security -> APIv3 key -> set up

Get the serial number of the merchant certificate

It is also necessary to obtain the serial number of the merchant certificate. The following are the steps to obtain it.

Log in the WeChat merchant platform -> Account center -> Account settings -> API security -> API certificate management -> copy the serial number.

You can refer to the WeChat payment merchant ID query guide , APIv3 key settings and How to view the certificate serial number for help.

Step4. Add payment provider

Select the WeChat Pay as the Payment type.

wechat_select

Get Payment URL

Log in the WeChat merchant platform -> Commodity centered -> Development arrangement -> payment arrangements -> Payment URL -> copy

Fill the necessary information in Casdoor

There are four required fields, Client ID, Client secret, appId, Provider URL. The relationship corresponding to the Azure Blob account is as follows:

NameName in WeChat Payis required
Client IDmerchant IDrequired
Client secretAPIv3 keyrequired
appIdappIdrequired
Provider URLPayment URLrequired

The acquisition of merchant ID and APIv3 key is as mentioned before. For appId, see here for more help.

wechat_provider

Step5. Add WeChat Cert

In this step, you need two required fields, serial number, private key.

How to obtain the serial number has been stated in the third step.

To get private key, click here for help.

wechat_cert

Step6. Add WeChat Payment Provider in Products

wechat_provider

Final effect: wechat_provider

What's more

You can explore the following projects/docs to learn more about WeChat Pay.