PHP code example of august6th / amzn-sp-api

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

    

august6th / amzn-sp-api example snippets


    



use SellingPartnerApi\Endpoint\Endpoint;

ellingPartner with specific options

//$sp = SellingPartner::withOptions([
//    [
//        'client_id' => 'xxx',
//        'client_secret' => 'xxx',
//        'refresh_token' => 'xxx',
//        'access_key_id' => 'xxx',
//        'secret_access_key' => 'xxx',
//        'role_arn' => 'xxx',
//        'endpoint' => Endpoint::NA(),
//    ]
//]);

// Or create SellingPartner with default options
// You can change defaultOptionsFunc before create SellingPartner

//SellingPartner::setDefaultOptionsFunc(function () {
//    return [
//        'client_id' => 'xxx',
//        'client_secret' => 'xxx',
//        'refresh_token' => 'xxx',
//        'access_key_id' => 'xxx',
//        'secret_access_key' => 'xxx',
//        'role_arn' => 'xxx',
//        'endpoint' => Endpoint::NA(),
//    ];
//});

$sp = SellingPartner::instance();
$res = $sp->sellersApi()->getMarketplaceParticipations();
print_r($res);