PHPackages                             andrewyj/amazon-sp-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. andrewyj/amazon-sp-api

ActiveLibrary[API Development](/categories/api)

andrewyj/amazon-sp-api
======================

Amazon selling partner sdk

0.0.1(4y ago)223PHPPHP &gt;=7.3

Since Jul 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/andrewyj/amazon-sp-api)[ Packagist](https://packagist.org/packages/andrewyj/amazon-sp-api)[ RSS](/packages/andrewyj-amazon-sp-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

What is Amazon Selling Partner API
==================================

[](#what-is-amazon-selling-partner-api)

SP-API is the next-generation API functionality suite for sellers and their agents to sell their products on the Amazon marketplace efficiently. Amazon Marketplace Web Services (Amazon MWS) APIs preceded SP-APIs and have been utilized extensively for over ten years. Amazon states in their documentation that the SP-API is the future and that SP APIs will receive any new updates and enhancements. However, one can expect a transition period from MWS to SP-API while the new system is stabilized and offers parity with the existing MWS APIs.

For more information visit:

Installation
------------

[](#installation)

```
composer require andrewyj/amazon-sp-api
```

Basic Usage
-----------

[](#basic-usage)

### 1. Define auth info

[](#1-define-auth-info)

```
$auth = [
    'refresh_token' => '', // Aztr|...
    'client_id' => '', // App ID from Seller Central, amzn1.sellerapps.app.cfbfac4a-......
    'client_secret' => '', // The corresponding Client Secret
    'region' => \AmazonSellingPartnerAPI\Client::REGION_NORTH_AMERICA,
    'access_key' => '', // Access Key of AWS IAM User, for example AKIAABCDJKEHFJDS
    'secret_key' => '', // Secret Key of AWS IAM User
    'role_arn' => '', // AWS IAM Role ARN for example: arn:aws:iam::123456789:role/Your-Role-Name
];
```

### 2. Use refresh\_token to exchange access\_token

[](#2-use-refresh_token-to-exchange-access_token)

```
$oAuth = new \AmazonSellingPartnerAPI\OAuth($auth['client_id'], $auth['client_secret']);
$auth['access_token'] = $oAuth->getAccessToken($auth['refresh_token'])->access_token;
```

### 3. Select a signature version(v4)

[](#3-select-a-signature-versionv4)

```
$sign = new \AmazonSellingPartnerAPI\Signature\V4Signature();
```

### 4. Fetch role info

[](#4-fetch-role-info)

```
$assumedRole = new \AmazonSellingPartnerAPI\AssumeRole($auth['region'], $auth['access_key'], $auth['secret_key'], $sign);
$credentials = $assumedRole->assume($auth['role_arn']);
$auth['access_key'] = $credentials['AccessKeyId'];
$auth['secret_key'] = $credentials['SecretAccessKey'];
$auth['session_token'] = $credentials['SessionToken'];
```

5. Make a request
-----------------

[](#5-make-a-request)

```
$client = new \AmazonSellingPartnerAPI\Client($sign);
$client->setAuth($auth);
var_dump($client->get('/orders/v0/orders/XXX-XXXXXX-XXXXXXX'));
```

Module usage
------------

[](#module-usage)

### 1. Define auth info

[](#1-define-auth-info-1)

[Define auth info](#basic-usage)

### 2. Select a module

[](#2-select-a-module)

```
$sign = new \AmazonSellingPartnerAPI\Signature\V4Signature();
$cache = new Cache();
$order = new \AmazonSellingPartnerAPI\Module\Order($auth, $cache, $sign);
```

> `Cache()` are used to cache role credentials and access\_token.It must have `get()` and `set()` functions. if you don't have one. create an adapter.

### 3. Make a request

[](#3-make-a-request)

```
# route param
var_dump($order->getOrder('XXX-XXXXXX-XXXXXXX')->send());

# query param
var_dump($order->getOrders()->withQuery([
  "CreatedAfter" => "2020-04-13T06:28:08Z",
  "MarketplaceIds" => [
      "XXXXXX",
  ]
])->send());
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1760d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33c9c53804132db3288368e699cc203e2a52d6bb903ab566274f5947898dc1f3?d=identicon)[andrewyj](/maintainers/andrewyj)

---

Top Contributors

[![andrewyj](https://avatars.githubusercontent.com/u/20654049?v=4)](https://github.com/andrewyj "andrewyj (41 commits)")

---

Tags

amazonsp-api

### Embed Badge

![Health badge](/badges/andrewyj-amazon-sp-api/health.svg)

```
[![Health](https://phpackages.com/badges/andrewyj-amazon-sp-api/health.svg)](https://phpackages.com/packages/andrewyj-amazon-sp-api)
```

###  Alternatives

[thewirecutter/paapi5-php-sdk

ProductAdvertisingAPI 5.0 PHP SDK

671.8M5](/packages/thewirecutter-paapi5-php-sdk)[revolution/laravel-amazon-product-api

Amazon Product Advertising API for Laravel

7950.2k](/packages/revolution-laravel-amazon-product-api)[looxis/laravel-amazon-mws

Simple Amazon MWS API Package for Laravel

3218.7k](/packages/looxis-laravel-amazon-mws)[okamos/php-ses

An Amazon SES api for PHP. Support signature version 4

2220.8k](/packages/okamos-php-ses)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
