Saltar al contenido principal

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:

    CasdoorValue
    TypePayment (x509)
    Certificatecontenido de appCertPublicKey.crt
    Private keycontenido de appPrivateKey.txt

    App Cert in Casdoor

  2. Add a certificate named Root Cert:

    CasdoorValue
    TypePayment (x509)
    Certificatecontenido de alipayCertPublicKey.crt
    Private keycontenido de alipayRootCert.crt

    Root Cert in Casdoor

Add the provider in Casdoor​

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

    CasdoorValue
    CategoryPago
    TypePago con Alipay
    Client IDAPPID from step 1.1
    CertApp Cert from step 1.2
    Root CertRoot Cert from step 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

información

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​