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/spapi-tokens: ^3.0
Requires (Dev)
- phpunit/phpunit: <12.0
README
Contents
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.
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.