PHPackages                             zero-to-prod/spapi-orders - 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. zero-to-prod/spapi-orders

ActiveLibrary[API Development](/categories/api)

zero-to-prod/spapi-orders
=========================

Amazon Selling Partner API (SPAPI) Orders API

v3.1.0(1y ago)21.2k↓100%[2 PRs](https://github.com/zero-to-prod/spapi-orders/pulls)MITPHPPHP &gt;=7.1CI passing

Since Feb 4Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/spapi-orders)[ Packagist](https://packagist.org/packages/zero-to-prod/spapi-orders)[ Docs](https://github.com/zero-to-prod/spapi-orders)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-spapi-orders/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (5)Versions (25)Used By (0)

Zerotoprod\\SpapiOrders
=======================

[](#zerotoprodspapiorders)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/spapi-orders)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/cc98f40eee33fdcee5f5f4697d5b7b3767cd64fc3dc1e792baf8a27da1906984/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73706170692d6f72646572732f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/spapi-orders/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/06a8bd7f8c730416c53bdcffdcb65e74b157b48f77e1b24f8aaf5eb3a20582fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f73706170692d6f72646572732f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/spapi-orders/actions)[![Packagist Downloads](https://camo.githubusercontent.com/9b531e1856cf29598f87b80cecdc4917ef37ab9b78dea2465b39bc0382cdd722/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f73706170692d6f72646572733f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/spapi-orders/stats)[![php](https://camo.githubusercontent.com/e700ef1b1baccaab0438399136cb333750ae17f33f3647583aeb95db8332b658/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f73706170692d6f72646572732e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/spapi-orders/stats)[![Packagist Version](https://camo.githubusercontent.com/281b1d511068105b3e2ef2a40ded9280e9df053aa02ee98e034a194a40cd8a1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f73706170692d6f72646572733f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/spapi-orders)[![License](https://camo.githubusercontent.com/64910218a62d4822b71eecb35204c427a90084764faebc58da6f993aa5da7506/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f73706170692d6f72646572733f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/spapi-orders/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/d6c3a1f623870d928b7dd26bc0d15ade4c1a1166af53c7d8dd01bce1aea889e4/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f73706170692d6f72646572732e737667)](https://wakatime.com/badge/github/zero-to-prod/spapi-orders)[![Hits-of-Code](https://camo.githubusercontent.com/67d0a5992e0b157f2e3ba5b5625fd9c0c0bc58c0412e67f99ab78c61bb079fbe/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f73706170692d6f72646572733f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/spapi-orders/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [getOrders](#getorders)
    - [getOrder](#getorder)
    - [getOrderBuyerInfo](#getorderbuyerinfo)
    - [getOrderAddress](#getorderaddress)
    - [getOrderItems](#getorderitems)
    - [getOrderItemsBuyerInfo](#getorderitemsbuyerinfo)
- [Testing](#testing)
    - [Factories](#factories)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

Amazon Selling Partner API (SPAPI) Orders API.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

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

[](#installation)

Install `Zerotoprod\SpapiOrders` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/spapi-orders
```

This will add the package to your project's dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/spapi-orders)
vendor/bin/zero-to-prod-spapi-orders

# Publish to custom directory
vendor/bin/zero-to-prod-spapi-orders /path/to/your/docs
```

### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-spapi-orders"
        ],
        "post-update-cmd": [
            "zero-to-prod-spapi-orders"
        ]
    }
}
```

Usage
-----

[](#usage)

### getOrders

[](#getorders)

Returns orders that are created or updated during the specified time period. If you want to return specific types of orders, you can apply filters to your request. NextToken doesn't affect any filters that you include in your request; it only impacts the pagination for the filtered orders response.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$orders_response = SpapiOrders::from('access_token')
->getOrders(
    ['MarketplaceIds']
    'CreatedAfter'
    'CreatedBefore'
    'LastUpdatedAfter'
    'LastUpdatedBefore'
    '[OrderStatuses']
    ['FulfillmentChannels']
    ['PaymentMethods']
    'BuyerEmail'
    'SellerOrderId'
    MaxResultsPerPage
    ['EasyShipShipmentStatuses']
    ['ElectronicInvoiceStatuses']
    'NextToken'
    ['AmazonOrderIds']
    'ActualFulfillmentSupplySourceId'
    'IsISPU'
    'StoreChainStoreId'
    'EarliestDeliveryDateBefore'
    'EarliestDeliveryDateAfter'
    'LatestDeliveryDateBefore'
    'LatestDeliveryDateAfter'
    ['curl-options']
);

$amazon_order_id = $orders_response['response']['payload']['Orders'][0]['AmazonOrderId']
```

### getOrder

[](#getorder)

Returns the order that you specify.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$order_response = SpapiOrders::from('access_token')
    ->getOrder('123-1234567-1234567', ['curl-options']);

$amazon_order_id = $order_response['response']['payload']['AmazonOrderId']
```

### getOrderBuyerInfo

[](#getorderbuyerinfo)

Returns buyer information for the order that you specify.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$order_response = SpapiOrders::from('access_token')
    ->getOrderBuyerInfo('123-1234567-1234567', ['curl-options']);

$buyer_name = $order_response['response']['payload']['BuyerName']
```

### getOrderAddress

[](#getorderaddress)

Returns the shipping address for a specific order.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$address_response = SpapiOrders::from('access_token')
    ->getOrderAddress(
        orderId: '123-1234567-1234567',
        options: [
            CURLOPT_TIMEOUT => 30,
        ]
    );

$shipping_address = $address_response['response']['payload'];
$address_line1 = $shipping_address['ShippingAddress']['AddressLine1'];
```

### getOrderItems

[](#getorderitems)

Returns detailed order item information for the order that you specify. If NextToken is provided, it's used to retrieve the next page of order items.

Note: When an order is in the Pending state (the order has been placed but payment has not been authorized), the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or promotions for the order items in the order. After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping charges, gift status and promotions for the order items in the order.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$order_items_response = SpapiOrders::from('access_token')
    ->getOrderItems('123-1234567-1234567', ['curl-options']);

$seller_sku = $order_items_response['response']['payload']['OrderItems'][0]['SellerSKU']
```

### getOrderItemsBuyerInfo

[](#getorderitemsbuyerinfo)

Returns detailed buyer information for each order item within a specific order.

```
use Zerotoprod\SpapiOrders\SpapiOrders;

$items_buyer_info_response = SpapiOrders::from('access_token')
    ->getOrderItemsBuyerInfo(
        orderId: '123-1234567-1234567',
        options: [
            CURLOPT_TIMEOUT => 30,
        ]
    );

$items_buyer_info_response['response']['payload']['OrderItems'][0]['OrderItemId'];
```

Testing
-------

[](#testing)

The package provides `SpapiOrdersFake` for testing your application without making real API calls:

```
use Zerotoprod\SpapiOrders\Support\Testing\SpapiOrdersFake;

$response = SpapiOrdersFake::fake(['response' => ['payload' => ['order' => 1]]]);

SpapiOrders::from('access_token')->getOrder('123-1234567-1234567');

$this->assertEquals(1, $response->getOrder('123-1234567-1234567')['response']['payload']['order']);
```

### Factories

[](#factories)

Use the factory to populate the fake response with dummy data:

```
$response = SpapiOrdersFake::fake(
    SpapiOrdersResponseFactory::factory([
        'response' => ['payload' => ['order' => 1]]
    ])->make()
);

SpapiOrders::from('access_token')->getOrder('123-1234567-1234567');

$this->assertEquals(1, $response->getOrder('123-1234567-1234567')['response']['payload']['order']);
```

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/spapi-orders/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance58

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Every ~0 days

Total

22

Last Release

411d ago

Major Versions

v1.4.1 → v2.0.02025-02-04

v2.1.0 → v3.0.02025-02-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (18 commits)")

---

Tags

zero-to-prodspapi-orders

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-spapi-orders/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-spapi-orders/health.svg)](https://phpackages.com/packages/zero-to-prod-spapi-orders)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14125.2k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

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