Prepare the keys

RSA key pair

An RSA key pair contains the private key and the public key. The private key is required for generating the signature, while the public key is used for verifying the signature.

Generate an RSA key pair

Generate an RSA key pair before calling the interface. The RSA key pair contains the application private key (APP_PRIVATE_KEY) and the application public key (APP_PUBLIC_KEY). Configure the key in Alipay open platform, and you can obtain the Alipay public key (ALIPAY_PUBLIC_KEY). After generating keys, you need to exchange keys with Alipay.

For more information, see: