PHP code example of vivlong / phalapi-alipay

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

    

vivlong / phalapi-alipay example snippets


    /**
     * 支付宝相关配置
     */
    'Alipay' =>  array(
        'appId'                 => '<yourAppId>',
        'rsaPrivateKey'         => '<yourRsaPrivateKey>',
        'alipayrsaPublicKey'    => '<yourAlipayrsaPublicKey>',
        'notifyUrl'             => '<yourNotifyUrl>',
    ),

$di->alipay = function() {
        return new \PhalApi\Alipay\Lite();
};

  \PhalApi\DI()->alipay->getOrderString('XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX');