Amazon Mws Submit Feed Custom Template

Laravel Amazon MWS

Software License Latest Version on Packagist Build Status StyleCI Scrutinizer Code Quality

Simple Amazon Marketplace Web Service API Package for Laravel

This package is under development. Currently we have only implemented the endpoints we are using. Feel free to add the endpoints you need (contribute). A List of all available endpoints you can see under the endpoint road map.

🚨 Amazon Introduced a new Selling Partner API A modernized suite of REST APIs utilizing standards. Github Docs The laravel-amazon-mws package provides only methods for the Amazon MWS service. We will add a laravel package for the SP-Api next year (2021).

Contents

  • Installation
  • Configuration
  • Usage
    • Authentication
    • Marketplaces
    • Orders
      • List Orders
      • Get Order
      • List Order Items
    • Feeds
      • Submit Feed
      • Submit Invoice Feed
      • Get Feed Submission Result
    • Merchant Fulfillment
      • Get Eligible Shipping Services
      • Get Shipment
      • Create Shipment
      • Cancel Shipment
      • Get Additional Seller Inputs
      • Get Service Status
    • Responses
    • Exceptions
  • Road Map
  • Testing
  • Changelog
  • Contributing
  • Security
  • License

Link to the Official Amazon MWS Documentation

Installation

This package requires PHP 7.3 and Laravel 8.0 or higher. For older laravel versions install the latest 0.1.x version.

Require the package using composer:

composer require looxis/laravel-amazon-mws

The package will automatically register itself.

Add your Environment Variables for MWS to your .env File. The variable names are listed in the amazon-mws.php config file.

Configuration

To successfully authenticate with the Amazon Marketplace Web Service you need to add the Environment variables to your .env File. The variable names are listed in the amazon-mws.php config file. Also you can set a default marketplace.

You can optionally publish the configuration with:

$ php artisan vendor:publish --provider=                "Looxis\LaravelAmazonMWS\AmazonMWSServiceProvider"                            --tag=                "config"                          

This will create an amazon-mws.php in your config directory.

Config file content with the env variables:

              <?php              return              [              'access_key_id'              => env('MWS_ACCESS_KEY_ID'),              'secret_key'              => env('MWS_SECRET_KEY'),              'seller_id'              => env('MWS_SELLER_ID'),              'mws_auth_token'              => env('MWS_AUTH_TOKEN'),              'default_market_place'              => env('MWS_DEFAULT_MARKET_PLACE',              'DE'), ];

Usage

Authentication

Amazon MWS authenticates you via the Canonicalized Query String. The Laravel Amazon MWS Package handles this for you and adds the string for each request. You just have to add your seller specific credentials to your .env file (configuration).

Marketplaces

If you need to change the marketplaces just set the country/countries in your code via the MWS Facade. For simplicity the package chooses the right endpoint and market place id via the given country. You do not have to set them by yourself. (Amazon MWS endpoints and Market Place IDS Overview) If something is missing do not hesitate to create an issue.

              AmazonMWS::setMarketplaces('FR');              AmazonMWS::setMarketplaces('DE',              'FR');              //to append multiple marketplaces to your request query strings.            

Orders

Retrieve order information that you need. Amazon MWS Orders Documentation Overview

List Orders

Returns orders created or updated during a time frame that you specify. MWS List Orders Documentation

                              $response              =              AmazonMWS::orders()->list([              'CreatedAfter'              =>              '2020-04-09T18:56:29+02:00'              ]);              // List Order By Next Token                              $response              =              AmazonMWS::orders()->list([              'NextToken'              =>              '27u07N+WSfaaJkJYLDm0ZAmQazDrhw3C...'              ]);
Throttling
  • maximum request quota of six and a restore rate of one request every minute. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Get Order

Returns orders based on the AmazonOrderId values that you specify. MWS Get Order Documentation

                              $response              =              AmazonMWS::orders()->get("1234-1234-1234");              //get amazon order by id                              $response              =              AmazonMWS::orders()->get("1234-1234-1234", "123-123-123");              //get multiple orders            
Throttling
  • maximum request quota of six and a restore rate of one request every minute. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

List Order Items

Returns order items based on the AmazonOrderId that you specify. MWS List Order Items Documentation

                              $response              =              AmazonMWS::orders()->getItems("1234-1234-1234");
Throttling
  • ListOrderItems and ListOrderItemsByNextToken share same throttling
  • maximum request quota of 30 and a restore rate of one request every two seconds. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Feeds

The Feeds API lets you upload inventory and order data to Amazon Amazon MWS Orders Documentation Overview

Submit Feed

Uploads a feed for processing by Amazon MWS.

You must set the feed type and content to successfully submit the feed. The content for the xml depends on the FeedType

                              $feedXmlContent              =              '<?xml version="1.0"?> ...';                              $response              =              AmazonMWS::feeds()                 ->setType("_POST_ORDER_ACKNOWLEDGEMENT_DATA_")                 ->setContent(                $xml)                 ->submit();
Throttling
  • maximum request quota of 15 and a restore rate of one request every two minutes.
  • Hourly request quote: 30 MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Submit Invoice Feed (VAT)

You can upload invoices using UPLOAD_VAT_INVOICE Feed Type via Feeds API. Use the SubmitFeed operation with the below mentioned parameters to submit an invoice for an order.

Invoice Uploader developer documentation

              // File Content                              $invoiceFileContent              = \File::get(storage_path('invoice.pdf'));              // Feed Options                              $params              = [              'orderid'              =>              'XXX-XXXXXXX-XXXXXXX',              //Amazon Order Id              'invoicenumber'              =>              'R21-1234',              //Your Invoice Number              'documenttype'              =>              'Invoice'              ];              // Generate Feed Option metadata from params                              $feedOptions              = collect(                $params)->map(function(                $param,                              $key) {              return              "metadata:{                $key}={                $param}";         })->values()->implode(';');              // Submit                              $response              =              AmazonMWS::feeds()                 ->setType("_UPLOAD_VAT_INVOICE_")                 ->setContent(                $invoiceFileContent)                 ->setParams([              'FeedOptions'              =>                              $feedOptions              ])                 ->submit();
Throttling

For the feed type UPLOAD_VAT_INVOICE, the throttle limit is 1 invoice upload per 3 seconds, or 20 invoices per minute, or 1200 invoices per hour, or 28800 invoices per day.

Responses

The Amazon MWS XML responses are parsed and will be casted into a convenient array structure. For checking if the Feed was successful you need to check the result via the GetSubmissionFeedResult endpoint.

SubmitFeedResponse Example:

[     "request_id" => "e86f7299-9712-43e3-b290-b659da85b527"     "data" => [         "FeedSubmissionId" => "2291326430"         "FeedType"                =>              "_POST_ORDER_ACKNOWLEDGEMENT_DATA_"                            "SubmittedDate" =>              "2020-03-04              T14:54:14+00:00"         "FeedProcessingStatus" => "_SUBMITTED_"     ] ]

Get Feed Submission Result

Returns the feed processing report and the Content-MD5 header.

Pass the Feed Submission Id as a parameter to retrieve the feed result Amazon MWS Description GetFeedSubmissionResult

Warning: Invoice Feed Submission Results are returning blank strings instead of a SubmitFeedResponse

                              $response              =              AmazonMWS::feeds()                 ->getFeedSubmissionResult(                $feedSubmissionId);
Throttling
  • maximum request quota of 15 and a restore rate of one request every minute.
  • Hourly request quote: 60 MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled
Responses

The Feed Submission Result responses are parsed and will be casted into a convenient structure.

SubmitFeedResponse Example:

[     "status_code" => "Complete",     "processing_summary" => [         "MessagesProcessed" => "2"         "MessagesSuccessful" => "2"         "MessagesWithError" => "0"         "MessagesWithWarning" => "0"     ],     "result" =>              null              ]

Merchant Fulfillment

With the Merchant Fulfillment service, you can build applications that let sellers purchase shipping for non-Prime and Prime orders using Amazon's Buy Shipping Services.

Amazon MWS Merchant Fulfillment Documentation Overview

Get Eligible Shipping Services

Returns a list of shipping service offers. MWS Get Eligible Shipping Services Documentation

Fill the params with the ShipmentRequestDetails and the ShippingOfferingFilter

                              $params              = [              'ShipmentRequestDetails'              => [...],              'ShippingOfferingFilter'              => [...] ];                              $response              =              AmazonMWS::merchantFulfillment()->getEligibleShippingServices(                $params);
Throttling
  • maximum request quota of 10 and a restore rate of 5 requests every second. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Get Shipment

Returns an existing shipment for a given identifier. MWS Get Shipment Documentation

                              $response              =              AmazonMWS::merchantFulfillment()->getShipment(                $shipmentId);
Throttling
  • maximum request quota of 10 and a restore rate of 5 requests every second. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Create Shipment

The CreateShipment operation purchases shipping and returns PDF, PNG, or ZPL document data for a shipping label, depending on the carrier. MWS Create Shipment Documentation

                              $data              = [              'ShippingServiceId'              =>              'shipment-service-id',              //get the shipment id with getEligibleShippingServices()              'ShipmentRequestDetails'              => [...], ];                              $response              =              AmazonMWS::merchantFulfillment()->createShipment(                $data);
Throttling
  • maximum request quota of 10 and a restore rate of 5 requests every second. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Cancel Shipment

Cancels an existing shipment. MWS Cancel Shipment Documentation

                              $shipmentId              =              '1234xx1231xx1234';                              $response              =              AmazonMWS::merchantFulfillment()->cancelShipment(                $shipmentId);
Throttling
  • maximum request quota of 10 and a restore rate of 5 requests every second. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Get Additional Seller Inputs

Returns a list of additional seller inputs that are required from the seller to purchase the shipping service that you specify. MWS Get Additional Seller Inputs Documentation

                              $data              = [              'OrderId'              =>              'XXX-XXXXXXX-XXXXXXX',              'ShippingServiceId'              =>              'shipment-service-id',              //get the shipment id with getEligibleShippingServices()              'ShippingFromAddress'              => [...], ];                              $response              =              AmazonMWS::merchantFulfillment()->getAdditionalSellerInputs(                $data);
Throttling
  • maximum request quota of 10 and a restore rate of 5 requests every second. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

Get Service Status

Returns the operational status of the Merchant Fulfillment service. MWS Get Service Status Documentation

                              $response              =              AmazonMWS::merchantFulfillment()->getServiceStatus();
Throttling
  • maximum request quota of 2 and a restore rate of 1 request every 5 seconds. MWS Throttling Algorithm
  • Throws a ServerException with Request is throttled

General Responses

Response Format Documentation The Amazon MWS XML responses are parsed and will be casted into a convenient array structure. GetOrder Response Example:

[     "request_id" => "be781aff-3c63-485a-aec8-951ed3be2ba4",     "data" => [         "AmazonOrderId" => "902-3159896-1390916",         ...     ] ]

Exceptions

The Laravel Amazon MWS package does not catch the Exceptions returned by guzzle. For Example for throttling ServerExceptions or missing Parameter Client Exceptions.

Endpoint Road map

Laravel Amazon MWS is still under development. We have only added the endpoints we currently are using ourselfs. We decided to ship it in this early stage so you can help to add some endpoits or use the already existing.

Endpoint List:

  • Orders (MWS Documentation Overview)
    • ListOrders
    • ListOrdersByNextToken
    • GetOrder
    • ListOrderItems
    • ListOrderItemsByNextToken
    • GetServiceStatus
    • Orders Datatypes
  • Feeds (MWS Documentation Overview)
    • SubmitFeed
    • Submit Invoice VAT Feed
    • GetFeedSubmissionList
    • GetFeedSubmissionListByNextToken
    • GetFeedSubmissionCount
    • CancelFeedSubmissions
    • GetFeedSubmissionResult
  • Easy Ship (MWS Documentation Overview)
  • Finances (MWS Documentation Overview)
  • FulFillment Inbound Shipment (MWS Documentation Overview)
  • FulFillment Inventory (MWS Documentation Overview)
  • FulFillment Outbound Shipment (MWS Documentation Overview)
  • Merchant Fulfillment (MWS Documentation Overview)
    • GetEligibleShippingServices
    • GetAdditionalSellerInputs
    • CreateShipment
    • GetShipment
    • CancelShipment
    • GetServiceStatus
  • Products (MWS Documentation Overview)
  • Recommendations (MWS Documentation Overview)
  • Reports (MWS Documentation Overview)
  • Sellers (MWS Documentation Overview)
  • Shipment Invoicing (MWS Documentation Overview)
  • Subscriptions (MWS Documentation Overview)

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Security

If you discover any security related issues, please email dev@looxis.com instead of using the issue tracker.

Credits

  • Christian Stefener
  • Jannik Malken
  • All Contributors

About us

LOOXIS GmbH based in Minden, Germany.

LOOXIS is a manufacturer of personalised gift articles, which are sold throughout Europe in (photo) specialist shops and via our online shop under www.looxis.com.

License

MIT

goinrobse1985.blogspot.com

Source: https://github.com/looxis/laravel-amazon-mws

0 Response to "Amazon Mws Submit Feed Custom Template"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel