PHP code example of naka1205 / alipay-php

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

    

naka1205 / alipay-php example snippets



use Alipay\Client;

$auth_code = $_GET['auth_code'];
$config = [
    'appid'       =>  'app_id',
    'gateway'     =>  'https://openapi.alipay.com/gateway.do',
    'type'        =>  'sign_type',
    'public'      =>  'public_key',
    'private'     =>  'private_key'
];
$aop = new Client($config);
$response = $aop->getToken($auth_code);
var_dump($response);