zero-to-prod / spapi-rdt
Create Restricted Data Tokens for Amazons Selling Partner API (SPAPI).
Fund package maintenance!
Github
Requires
- php: >=7.1
- zero-to-prod/container: ^0.1.2
- zero-to-prod/factory: ^0.1.1
- zero-to-prod/package-helper: ^1.1.3
- zero-to-prod/spapi-tokens: ^3.0
Requires (Dev)
- phpunit/phpunit: <12.0
This package is auto-updated.
Last update: 2025-09-08 03:36:22 UTC
README
Contents
- Introduction
- Requirements
- Installation
- Documentation Publishing
- Usage
- Testing
- Local Development
- Contributing
Introduction
Create Restricted Data Tokens for Amazons Selling Partner API (SPAPI).
Requirements
- PHP 7.1 or higher.
Installation
Install Zerotoprod\SpapiRdt
via Composer:
composer require zero-to-prod/spapi-rdt
This will add the package to your project's dependencies and create an autoloader entry for it.
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-rdt) vendor/bin/zero-to-prod-spapi-rdt # Publish to custom directory vendor/bin/zero-to-prod-spapi-rdt /path/to/your/docs
Automatic Documentation Publishing
You can automatically publish documentation by adding the following to your composer.json
:
{ "scripts": { "post-install-cmd": [ "zero-to-prod-spapi-rdt" ], "post-update-cmd": [ "zero-to-prod-spapi-rdt" ] } }
Usage
Orders
Access the different endpoints for getting Restricted Data Tokens for the Orders API
use Zerotoprod\SpapiRdt\SpapiRdt; $response = SpapiRdt::from('access_token', 'targetApplication') ->orders() ->getOrders('123-1234567-1234567'); $restrictedDataToken = $response['response']['restrictedDataToken']
Testing
You can test the api by faking the response:
use Zerotoprod\SpapiRdt\SpapiRdt; use Zerotoprod\SpapiRdt\Support\Testing\SpapiRdtFake; use Zerotoprod\SpapiRdt\Support\Testing\SpapiRdtResponseFactory; SpapiRdtFake::fake( SpapiRdtResponseFactory::factory()->make() ); $response = SpapiRdt::from('access_token', 'targetApplication') ->orders() ->getOrders();
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.