PHP code example of denisneuf / thinkphp-paypal-api

1. Go to this page and download the library: Download denisneuf/thinkphp-paypal-api 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/ */

    

denisneuf / thinkphp-paypal-api example snippets



declare (strict_types = 1);

namespace app\controller;

use app\BaseController;
use think\facade\Env;
use think\facade\View;
use think\Request;
use think\Log;

use PayPalSdk\Core\PayPalClient;
use PayPalSdk\disputes\DisputesGetRequest;
use PayPalHttp\HttpException;

class YourController extends BaseController
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */

    public function index(Log $log)
    {

        $request = new DisputesGetRequest();

        try{
            $client = PayPalClient::client();
            $response = $client->execute($request);
        }
        catch(HttpException $exception){
            $message = json_decode($exception->getMessage(), true);
            dump($message);
            exit;
        }
        finally
        {

        	$log->info(gettype($response->result->items));
        }


        View::assign('title','View Disputes');
        View::assign('lang', Env::get('lang.default_lang'));
        View::assign('description','View Disputes');
        View::assign('list', $response->result->items);
        return View::fetch('admin/list/dispute');

    }

}

use think\facade\Cache;

use think\facade\Env;

use \think\facade\Filesystem;

To upload files from ThinkPHP Filesystem