PHP code example of xplalipay / alipay

1. Go to this page and download the library: Download xplalipay/alipay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xplalipay / alipay example snippets


return [
    //....
    'components' => [
		'alipay'=>[
            'class'=>'xplalipay\alipay\Alipay',
            'back_url'=> '回调地址',
            'gateway_url' => 'https://openapi.alipay.com/gateway.do',
            'app_id' => 'APPID',
            'rsa_private_key' => '私钥',
            'format' => 'json',
            'charset'=>'UTF-8',
            'sign_type'=>"RSA2",
            'alipayrsa_public_key' => "公钥"
        ],
    ],
];

php composer.phar 

$resultNotify = \Yii::$app->alipay->notify();
        $result = false;
        if($resultNotify){
            $notifyData = \Yii::$app->request->post();
            $result = "回调逻辑";
        }
        if($result){
            echo 'SUCCESS';
        }else{
            echo 'ERROR';
        }