PHP code example of bricre / ebay-api-buy-order

1. Go to this page and download the library: Download bricre/ebay-api-buy-order 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/ */

    

bricre / ebay-api-buy-order example snippets



use Ebay\Sell\Account\ResponseTypes;
use OpenAPI\Runtime\DefaultResponseHandlerStack;
use OpenAPI\Runtime\Client;
use OpenAPI\Runtime\SimplePsrResponseHandlerStack;

Client::configure(
    new \GuzzleHttp\Client([
        'base_uri' => 'https://api.ebay.com/buy/order/v2/',
        'headers'=>[
            'Authorization'=> 'Bearer <accessToken>'
        ]
    ]),
    new SimplePsrResponseHandlerStack(new ResponseTypes())
);



use Ebay\Sell\Account\Api\PaymentsProgram;
use Ebay\Sell\Account\Api\Program;

$programAPI = new Program();

$programs = $programAPI->getOptedIns();

$paymentsProgramAPI = new PaymentsProgram();

$response = $paymentsProgramAPI->get('marketplace_id','payments_programe_type');