跳到主内容

Take payments with Alipay

This guide explains how to let users pay for your Casdoor products with Alipay.


Learning outcomes​

  • Get the APPID and the certificates of an Alipay merchant application.
  • Store the certificates in Casdoor.
  • Add Alipay as a payment provider and add it to a product.

What you need​


Prepare Alipay​

  1. Create an application in the console of the Alipay Open Platform and note its APPID. See Find the APPID.
  2. Generate an RSA2 key pair as the Alipay documentation describes. You get appPrivateKey.txt and appPublicKey.txt.
  3. Upload the certificate to the application and download three files: alipayRootCert.crt, appCertPublicKey.crt, and alipayCertPublicKey.crt.

Store the certificates in Casdoor​

  1. On the Certs page of the Casdoor admin console, add a certificate named App Cert:

    Casdoor值
    Type支付(x509)
    CertificateappCertPublicKey.crt的内容
    Private keyappPrivateKey.txt的内容

    App Cert in Casdoor

  2. Add a certificate named Root Cert:

    Casdoor值
    Type支付(x509)
    CertificatealipayCertPublicKey.crt的内容
    Private keyalipayRootCert.crt的内容

    Root Cert in Casdoor

Add the provider in Casdoor​

  1. Go to Identity > Providers and add a provider with the following values:

    Casdoor值
    Category支付
    Type支付宝
    Client ID第1.1步的APPID
    Cert第1.2步的应用证书
    Root Cert第1.2步的根证书

    Alipay payment provider in Casdoor

  2. Save the provider.

Add the provider to a product​

Add the provider to the Payment providers of the product and save it.

Alipay in the payment providers of a product

信息

Alipay supports only Chinese yuan (CNY). Set the currency of the product to CNY. Casdoor rejects a product with Alipay in another currency when you save it.

See also​