PHP code example of t3rryw1 / alipay-sdk

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

    

t3rryw1 / alipay-sdk example snippets


    $keyPair = \Alipay\Key\AlipayKeyPair::create(
        '应用私钥',
        '支付宝公钥',
    );
    

    $aop = new \Alipay\AopClient('APP_ID', $keyPair,true);
    

    $request = (new \Alipay\AlipayRequestFactory)->create('点号连接的API名称', [
        '请求参数名' => '对应参数值',
        // ...
    ]);
    

    $request = new \Alipay\Request\AlipaySystemOauthTokenRequest();
    $request->setCode('authcode');
    

    $result = $aop->execute($request)->getData();