PHP Alipay App payment service side operation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.