1. Go to this page and download the library: Download hkonnet/selling-partner-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/ */
hkonnet / selling-partner-api example snippets
$config = new SellingPartnerApi\Configuration([
"lwaClientId" => "<LWA client ID>",
"lwaClientSecret" => "<LWA client secret>",
"lwaRefreshToken" => "<LWA refresh token>",
"awsAccessKeyId" => "<AWS access key ID>",
"awsSecretAccessKey" => "<AWS secret access key>",
// If you're not working in the North American marketplace, change
// this to another endpoint from lib/Endpoint.php
"endpoint" => SellingPartnerApi\Endpoint::NA,
]);
$config = new SellingPartnerApi\Configuration([
"lwaClientId" => "<LWA client ID>",
"lwaClientSecret" => "<LWA client secret>",
"lwaRefreshToken" => "<LWA refresh token>",
"awsAccessKeyId" => "<AWS access key ID>",
"awsSecretAccessKey" => "<AWS secret access key>",
// If you're not working in the North American marketplace, change
// this to another endpoint from lib/Endpoint.php
"endpoint" => SellingPartnerApi\Endpoint::NA,
"roleArn" => "<Role ARN>",
]);
SellingPartnerApi\Api;
use SellingPartnerApi\Configuration;
use SellingPartnerApi\Endpoint;
$config = new Configuration([
"lwaClientId" => "amzn1.application-oa2-client.....",
"lwaClientSecret" => "abcd....",
"lwaRefreshToken" => "Aztr|IwEBI....",
"awsAccessKeyId" => "AKIA....",
"awsSecretAccessKey" => "ABCD....",
// If you're not working in the North American marketplace, change
// this to another endpoint from lib/Endpoint.php
"endpoint" => Endpoint::NA
]);
$api = new Api\SellersApi($config);
try {
$result = $api->getMarketplaceParticipations();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SellersApi->getMarketplaceParticipations: ', $e->getMessage(), PHP_EOL;
}