PHP code example of xiaochengfu / yii2-alipay

1. Go to this page and download the library: Download xiaochengfu/yii2-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/ */

    

xiaochengfu / yii2-alipay example snippets


return [
    //手机网站支付配置
    'aliPay_rsa_config' => [
        'partner' => '你的商户id',
        'seller_id' => '你的商户id',
        'private_key' => '私钥',
        'alipay_public_key' => '公钥',
        'sign_type' => strtoupper('RSA'),
        'notify_url' => "xxx/notify-ali-pay",
        'input_charset' => strtolower('utf-8'),
        'cacert' => getcwd() . '\\cacert.pem',
        'transport' => 'http',
        'payment_type' => "1",//支付类型
        'service' => "create_direct_pay_by_user",  //即时到账(扫码)
//        'service'       => "alipay.wap.create.direct.pay.by.user",//手机网站支付
        'return_url' => "http://xxx/callback",
        'anti_phishing_key' => "",
        'exter_invoke_ip' => "",
    ],
    //单笔转账配置,appid要在支付宝开放平台添加应用,私钥、公钥、回调地址均在开发平台设置
    'aliPayOauthConfig' =>[
        'appId'=>'xxxx',
        'callBack'=>'http://xxx/alipay/default/ali-callback',//扫码授权回调地址
        'rsaPrivateKey' =>'你的私钥',
        'alipayrsaPublicKey' => '你的公钥'
    ]
];