Home >Backend Development >PHP Tutorial >PHP docking mobile Alipay process and detailed description of the merchant's private key and public key 9 (picture)
1. You must sign a contract with Alipay first
2. Go to Alipay official website to download skd
3. This is also the most convoluted and complicated point
1. Use the downloaded sdk to generate a secret key (these three commands are explained in the sdk document, just install the tool and generate them in order)
Generate RSA private key
openssl>g enrsa -out rsa_private_key.pem 1024 (php服务端用)
Generate RSA public key
openssl> rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem (网站配置)
#Convert RSA private key to PKCS8 format
openssl> pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt (ios或者安卓用)4, then not
The code in ify_url.php is the code of the callback function on the php side. (It is best to write an interface for ios and Android to use as their callback interface. )
if ($_POST['trade_status'] == 'TRADE_FINISHED') else if ($_POST['trade_status'] == 'TRADE_SUCCESS')
Add your own local data processing, and a bunch of callback information and specific situation interface documents will be returned if the payment is successful
Note: Even if the callback function is not used, the client can still pay successfully and does not conflict with the server. Therefore, when configuring the server, be sure to pay attention to the three configuration files# of private_key_path, ali_public_key_path, and cacert. Is the address of ## correct?
The above is the detailed content of PHP docking mobile Alipay process and detailed description of the merchant's private key and public key 9 (picture). For more information, please follow other related articles on the PHP Chinese website!