The first step: Download the website demo
Step Two: Introduce the demo code into the program
function Getappcode ($order, $config _value) {require_once (' aop/aopclient.php ');
Require_once (' aop/request/alipaytradeapppayrequest.php ');
$AOP = new \aopclient ();
* * Sandbox test Alipay began $aop->gatewayurl = "Https://openapi.alipay.com/gateway.do"; Actually the line app ID needs to be true $aop->appid = "00000"; Developer AppID $AOP->rsaprivatekey = ';
Fill in tool generated merchant application private key $AOP->format = "json";
$AOP->charset = "UTF-8";
$AOP->signtype = "RSA2"; $AOP->alipayrsapublickey = '; Fill out the PayPal public key from Alipay open background View $bizcontent = Json_encode ([' Body ' => $order [' order_sn '], ' subject ' = > ' * * *, ' out_trade_no ' => $order [' order_sn '],//This order number is the merchant's unique order number ' Total_amount ' => $order [' Order_
Amount '],//retains two decimal places ' product_code ' => ' Quick_msecurity_pay '); * * Sandbox test Alipay end//instantiate specific API corresponding to the request class, class name and interface name corresponding to the current calling interface name: Alipay.trade.app.pay $request = new \alipaytradeap PpayreqUest ();
Alipay callback $request->setnotifyurl (' Asynchronous notification address ', true,true));
$request->setbizcontent ($bizcontent);
This is different from the ordinary interface call, using the Sdkexecute $response = $aop->sdkexecute ($request);
return $response; }Step three: Generate application private key and Alipay public key official tutorial
After downloading the tool, unpack the open folder and run the RSA Signature Verification tool. Bat (WINDOWS) or the RSA Signature Verification tool. Command (MAC_OSX).
Sample interface:
Detailed steps:
1. Select the key format according to the development language.
2. Select the key length, 2048 bits are recommended.
3. Click "Generate Key", will automatically generate merchant application public key and apply private key.
4. Click on "Open key file path" to find the generated public private key. As shown in figure:
The generated private key needs to be kept in good custody to avoid loss and leakage. Applying the private key is required to be filled in code for signature. Application of public key needs to be provided to Alipay account Manager on the open platform of Alipay
Configure Development Platform Application Note: The code uses the private key and the Alipay public key
Fourth step: After the code is refined, you can generate client information