Download the PHP package jlevers/selling-partner-api without Composer

On this page you can find all versions of the php package jlevers/selling-partner-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package selling-partner-api

Total downloads Latest stable version License

Selling Partner API for PHP

A PHP library for connecting to Amazon's Selling Partner API.

Related packages


This package is developed and maintained by Highside Labs. If you need support integrating with Amazon's (or any other e-commerce platform's) APIs, we're happy to help! Shoot us an email at [email protected]. We'd love to hear from you :)

If you've found any of our packages useful, please consider becoming a Sponsor, or making a one-time donation via the button below. I appreciate any and all support you can provide!

Donate to Highside Labs

Sponsored by Tesmo.


Features

Installation

composer require jlevers/selling-partner-api

Table of Contents

Check out the Getting Started section below for a quick overview.

This README is divided into several sections:

Getting Started

Prerequisites

To get started, you need an approved Selling Partner API developer account, and SP API application credentials, which you can get by creating a new SP API application in Seller Central.

Setup

The SellingPartnerApi class acts as a factory to generate API connector instances. It takes a set of (optionally) named parameters. Its basic usage looks like this:

[!NOTE] Older versions of the Selling Partner API used AWS IAM credentials to authenticate, and so this library had additional AWS configuration options. If you're upgrading from an older version of this library and are confused about what to do with your AWS creds, you can just ignore them. The SP API no longer authenticates via AWS IAM roles or users.

Now you have a Selling Partner API connector instance, and you can start making calls to the API. The connector instance has methods for each of the API segments (e.g., sellers, orders, fba-inbound), and you can access them like so:

Once you have a response, you can either access the raw JSON response via $response->json(), or you can automatically parse the response into a DTO by calling $response->dto(). Once the response is turned into a DTO, you can access the data via the DTO's properties. For instance, you can get the first order's purchase date like so:

See the Working with DTOs section for more details on how to work with requests and responses.

Configuration options

The SellingPartnerApi::make() builder method accepts the following keys:

Debugging

To get detailed debugging output, you can take advantage of Saloon's debugging hooks. This package is built on top of Saloon, so anything that works in Saloon will work here. For instance, to debug requests:

Then make requests with the connector as usual, and you'll hit the closure above every time a request is fired. You can also debug responses in a similar fashion – check out the Saloon docs for more details.

Supported API segments

Each API class name contains the API's version. This allows for multiple versions of the same API to be accessible in a single version of this package. It makes the class names a little uglier, but allows for simultaneously using new and old versions of the same API segment, which is often useful. The uglier names can be remedied by formatting use statements like so:

It also means that if a new version of an existing API is introduced, the library can be updated to include that new version without introducing breaking changes.

Seller APIs

Seller APIs are accessed via the SellerConnector class:

Vendor APIs

Vendor APIs are accessed via the VendorConnector class:

Restricted operations

When you call a restricted operation, a Restricted Data Token (RDT) is automatically generated. If you're calling restricted operations that accept a dataElements parameter, specify the restricted data elements you want to retrieve in the dataElements parameter of SellingPartnerApi::make(). Currently, getOrder, getOrders, and getOrderItems are the only restricted operations that take a dataElements parameter.

Note that if you want to call a restricted operation on a sandbox endpoint (e.g., Endpoint::NA_SANDBOX), you should not specify any dataElements. RDTs are not necessary for restricted operations in the sandbox.

If you would like to make calls on behalf of a delegatee application, you can specify the delegatee parameter in SellingPartnerApi::make(). This will cause the connector to generate a token for the delegatee application instead of the main application.

Uploading and downloading documents

The Feeds and Reports APIs include operations that involve uploading and downloading documents to and from Amazon. This library has integrated supports for uploading and downloading documents on the relevant DTOs: ReportDocument, CreateFeedDocumentResponse, and FeedDocument, which are the result of calling getReportDocument, createFeedDocument, and getFeedDocument, respectively.

Downloading a report document

The download method has three parameters:

If you are working with huge documents you can use downloadStream() to minimize the memory consumption. downloadStream() returns a Psr\Http\Message\StreamInterface.

Uploading a feed document

If you are working with feed documents that are too large to fit in memory, you can pass anything that Guzzle can turn into a stream into FeedDocument::upload() instead of a string.

Downloading a feed result document

This process is very similar to downloading a report document:

Naming conventions

Wherever possible, the names of the classes, methods, and properties in this package are identical to the names used in the Selling Partner API documentation. There are limited cases where this is not true, such as where the SP API documentation itself is inconsistent: for instance, there are some cases the SP API docs name properties in UpperCamelCase instead of camelCase, and in those cases the properties are named in camelCase in this package. Methods are named in camelCase, and DTOs are named in UpperCamelCase.

Instead of maintaining a redundant set of documentation, we link to the official SP API documentation whenever possible. If it's unclear how to use a particular method or DTO, check out the corresponding section of the official SP API documentation.

API versions

Some Selling Partner API segments have multiple versions. For instance, the Product Pricing API has two versions: v0 and v2022-05-01. The connector method SellerConnector::productPricing() points to the newer version (v2022-05-01), but you can get an instance of the older version by calling SellerConnector::productPricingV0(). Or, if you want to explicitly specify v2022-05-01 in a way that will not break in a future major release if a new version of the API is introduced, you can call SellerConnector::productPricingV20220501().

More generally, the latest version of a given API segment (at the time when the major version of this library you're using was released) can be accessed with Connector::apiName(). Specific versions can be accessed with Connector::apiNameV<version>().

Working with DTOs

Some methods take DTOs as parameters. For instance, the confirmShipment method in the Orders API takes a ConfirmShipmentRequest DTO as a parameter. You can call confirmShipment like so:


All versions of selling-partner-api with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
ext-mbstring Version *
composer/semver Version ^3.4
guzzlehttp/guzzle Version ^6.0|^7.0
highsidelabs/saloon-sdk-generator Version ^1.0
saloonphp/saloon Version ^3.4
openspout/openspout Version ^4.23
illuminate/support Version ^10.48
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jlevers/selling-partner-api contains the following files

Loading the files please wait ....