Lue dans les fichiers PHP du paquet au commit 4835f722d00a : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
AmazonGatewayFactoryclassAmazon, through the Creators API (which replaced the Product Advertising API 5 on 2026-05-15): a product by its ASIN or its page (getItems), a search (searchItems), and the affiliate link carrying the Associates partner tag. Nothing is bought here: no API lets a site buy for someone.
12 options · 1 constant
ApiclassThe Creators API's two calls, as its documentation shows them: an OAuth 2.0 client-credentials token (scope creatorsapi::default, JSON body, valid an hour, kept until a minute before it runs out), then POST {api_url}/getItems or /searchItems with the bearer token, the x-marketplace header and, in the JSON body, partnerTag, marketplace and the resources asked for (lowerCamelCase).
5 methods · 3 constants
ItemsclassA Creators API item as an Omnitrade Product, and an ASIN found in an Amazon address.
3 methods
AffiliateLinkActionclassThe product's page with the Associates partner tag: https://<marketplace>/dp/<ASIN>?tag=<tag>, from an ASIN or any Amazon address naming one. No API call. Null without a tag, or for an address that names no product.
3 methods
FetchProductActionclassA product by its ASIN or an Amazon page naming one (getItems); null when it names none or Amazon has none.
3 methods
FetchProductsActionclassA search of Amazon's catalogue (searchItems, keywords, at most 10 items): Amazon is not a catalogue to page through, so a query is required, and neither a cursor nor updatedSince is read - the documentation shows no paging; the page has no next.
3 methods
Omnitrade\Amazon
AmazonGatewayFactory class
final class AmazonGatewayFactory extends GatewayFactory AmazonGatewayFactory.php:34
Amazon, through the Creators API (which replaced the Product Advertising API 5 on 2026-05-15): a product by its ASIN or its page (getItems), a search (searchItems), and the affiliate link carrying the Associates partner tag. Nothing is bought here: no API lets a site buy for someone.
options: client_id: '%env(AMAZON_CREATORS_CLIENT_ID)%' # the Creators API credentials client_secret: '%env(AMAZON_CREATORS_CLIENT_SECRET)%' partner_tag: '%env(AMAZON_CREATORS_PARTNER_TAG)%' # mysite-21 marketplace: www.amazon.fr # the store the items and prices are read in credential_version: '3.2' # 3.1 North America, 3.2 Europe, 3.3 Far East: the token endpoint token_url: null # another token endpoint (a v2 Cognito one) api_url: 'https://creatorsapi.amazon/catalog/v1' timeout: 10
Without credentials - an account not yet eligible, the API being opened only after qualified sales - only affiliateLink() is offered: the tag alone is enough to write it, and the product is read from its page (omnitrade/web) meanwhile.
Options
| Option | Default | |
|---|---|---|
client_id | null | |
client_secret | null | |
partner_tag | null | |
marketplace | 'www.amazon.fr' | |
credential_version | '3.2' | |
token_url | null | |
api_url | Api::API_URL | |
timeout | 10 | |
omnitrade.api | function (Config $c) {
$tokenUrl = $c['token_url'] ?: self::TOKEN_URLS[(string) $c['credential_version']] ?? throw new InvalidConfigException(sprintf('Un… | |
omnitrade.action.affiliate | static fn(Config $c) => new AffiliateLinkAction((string) $c['marketplace'], (string) $c['partner_tag']) | |
omnitrade.action.product | static fn(Config $c) => $c['client_id'] && $c['client_secret'] ? new FetchProductAction() : null | The API's reads only with credentials: without, supports() says no. |
omnitrade.action.products | static fn(Config $c) => $c['client_id'] && $c['client_secret'] ? new FetchProductsAction() : null |
const TOKEN_URLS = ['3.1' => 'https://api.amazon.com/auth/o2/token', '3.2' => 'https://api.amazon.co.uk/auth/o2/token', '3.3' => 'https://api.amazon.co.jp/auth/o2/token']
Api class
final class Api Api.php:18
The Creators API's two calls, as its documentation shows them: an OAuth 2.0 client-credentials token (scope creatorsapi::default, JSON body, valid an hour, kept until a minute before it runs out), then POST {api_url}/getItems or /searchItems with the bearer token, the x-marketplace header and, in the JSON body, partnerTag, marketplace and the resources asked for (lowerCamelCase).
const API_URL = 'https://creatorsapi.amazon/catalog/v1'const SCOPE = 'creatorsapi::default'const RESOURCES = ['images.primary.large', 'images.variants.large', 'itemInfo.title', 'itemInfo.byLineInfo', 'itemInfo.features', 'itemInfo.externalIds', 'itemInfo.classificat…What a product is read with: its title, brand, features, images, offers, page.
Api::__construct()
public function __construct(readonly HttpClientInterface $http, readonly string $clientId, readonly string $clientSecret, readonly string $partnerTag, readonly string $marketplace, readonly string $tokenUrl, readonly string $apiUrl = self::API_URL, readonly int $timeout = 10)Api::marketplace()
public function marketplace(): stringApi::partnerTag()
public function partnerTag(): stringApi::getItems()
public function getItems(array $asins): array$asinsat most 10
- Returns
the items found (itemsResult.items)
Api::searchItems()
public function searchItems(string $keywords, int $count = 10): array- Returns
the items found (searchResult.items)
Items class
final class Items Items.php:13
A Creators API item as an Omnitrade Product, and an ASIN found in an Amazon address.
Items::asin()
public static function asin(string $idOrUrl): ?string"B0C1234567" in /dp/B0C1234567, /gp/product/B0C1234567, /exec/obidos/ASIN/..., or a bare ASIN.
Items::isAmazon()
public static function isAmazon(string $url): boolItems::product()
public static function product(array $item, string $marketplace): ProductOmnitrade\Amazon\Action
AffiliateLinkAction class
final class AffiliateLinkAction implements ActionInterface AffiliateLinkAction.php:15
The product's page with the Associates partner tag: https://<marketplace>/dp/<ASIN>?tag=<tag>, from an ASIN or any Amazon address naming one. No API call. Null without a tag, or for an address that names no product.
AffiliateLinkAction::__construct()
public function __construct(readonly string $marketplace, readonly string $partnerTag = '')AffiliateLinkAction::supports()
public function supports(Request $request): boolAffiliateLinkAction::execute()
public function execute(Request $request): voidFetchProductAction class
final class FetchProductAction implements ActionInterface, ApiAwareInterface FetchProductAction.php:14
A product by its ASIN or an Amazon page naming one (getItems); null when it names none or Amazon has none.
FetchProductAction::__construct()
public function __construct()FetchProductAction::supports()
public function supports(Request $request): boolFetchProductAction::execute()
public function execute(Request $request): voidFetchProductsAction class
final class FetchProductsAction implements ActionInterface, ApiAwareInterface FetchProductsAction.php:21
A search of Amazon's catalogue (searchItems, keywords, at most 10 items): Amazon is not a catalogue to page through, so a query is required, and neither a cursor nor updatedSince is read - the documentation shows no paging; the page has no next.
FetchProductsAction::__construct()
public function __construct()FetchProductsAction::supports()
public function supports(Request $request): boolFetchProductsAction::execute()
public function execute(Request $request): void