Skip to content

omnitrade/amazon API reference

Floor
Provider · Omnitrade
Version
1.x
Conformance suite
runs, no CI read
Verified for real
Its README does not say
Licence
MIT
composer require omnitrade/amazon:1.x-dev

Read from the package's own PHP files at the commit 4835f722d00a: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnitrade\Amazon

  • AmazonGatewayFactory class

    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.

    12 options · 1 constant

  • Api class

    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).

    5 methods · 3 constants

  • Items class

    A Creators API item as an Omnitrade Product, and an ASIN found in an Amazon address.

    3 methods

Omnitrade\Amazon\Action

  • AffiliateLinkAction class

    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.

    3 methods

  • FetchProductAction class

    A product by its ASIN or an Amazon page naming one (getItems); null when it names none or Amazon has none.

    3 methods

  • FetchProductsAction class

    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.

    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

OptionDefault
client_idnull
client_secretnull
partner_tagnull
marketplace'www.amazon.fr'
credential_version'3.2'
token_urlnull
api_urlApi::API_URL
timeout10
omnitrade.apifunction (Config $c) { $tokenUrl = $c['token_url'] ?: self::TOKEN_URLS[(string) $c['credential_version']] ?? throw new InvalidConfigException(sprintf('Un…
omnitrade.action.affiliatestatic fn(Config $c) => new AffiliateLinkAction((string) $c['marketplace'], (string) $c['partner_tag'])
omnitrade.action.productstatic fn(Config $c) => $c['client_id'] && $c['client_secret'] ? new FetchProductAction() : nullThe API's reads only with credentials: without, supports() says no.
omnitrade.action.productsstatic 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(): string

Api::partnerTag()

public function partnerTag(): string

Api::getItems()

public function getItems(array $asins): array
$asins

at 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): bool

Items::product()

public static function product(array $item, string $marketplace): Product

Omnitrade\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): bool

AffiliateLinkAction::execute()

public function execute(Request $request): void

FetchProductAction 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): bool

FetchProductAction::execute()

public function execute(Request $request): void

FetchProductsAction 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): bool

FetchProductsAction::execute()

public function execute(Request $request): void