Download the PHP package zero-to-prod/spapi without Composer
On this page you can find all versions of the php package zero-to-prod/spapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zero-to-prod/spapi
More information about zero-to-prod/spapi
Files in zero-to-prod/spapi
Package spapi
Short Description A PHP client library for Amazon's Selling Partner API.
License MIT
Homepage https://github.com/zero-to-prod/spapi
Informations about the package spapi
Zerotoprod\Spapi
Contents
- Introduction
- Requirements
- Installation
- Authentication
- Refresh Token
- Client Credentials
- Restricted Data Token
- Orders Api
- getOrders
- getOrder
- getOrderBuyerInfo
- getOrderAddress
- getOrderItems
- Testing
- Basic Testing
- Testing with Authentication Flow
- Examples
- Get an order with a Restricted Data Token
- Local Development
- Contributing
Introduction
A PHP client library for Amazon's Selling Partner API.
Requirements
- PHP 7.1 or higher.
Installation
Install Zerotoprod\Spapi
via Composer:
This will add the package to your project’s dependencies and create an autoloader entry for it.
Authentication
Refresh Token
Use this for calling operations that require authorization from a selling partner. All operations that are not grantless operations require authorization from a selling partner. When specifying this value, include the rrefresh_token parameter.
Client Credentials
Use this for calling grantless operations. When specifying this value, include the scope parameter.
Restricted Data Token
Use the access token received from Login With Amazon;
Spapi
Instantiate the Spapi from an access_token
generated from Restricted Data Token
Orders Api
Programmatically retrieve order information.
Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.
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.
getOrder
Returns the order that you specify.
getOrderBuyerInfo
Returns buyer information for the order that you specify.
getOrderAddress
Retrieves the shipping address for the specified order
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.
Examples
Get an order with a Restricted Data Token
Testing
Basic Testing
The package provides a robust testing framework using the SpapiFake
class. This allows you to mock API responses without making actual HTTP requests.
Testing with Authentication Flow
For testing the complete authentication flow, you'll need to mock both LWA (Login with Amazon) and RDT (Restricted Data Token) responses:
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
All versions of spapi with dependencies
ext-curl Version *
ext-json Version *
zero-to-prod/spapi-lwa Version ^4.0
zero-to-prod/spapi-orders Version ^3.0
zero-to-prod/container Version ^0.1.2
zero-to-prod/spapi-rdt Version ^4.0