Orders

class sp_api.api.Orders(marketplace: Marketplaces = Marketplaces.US, *, refresh_token=None, account='default', credentials=None, restricted_data_token=None, proxies=None, verify=True, timeout=None, version=None, credential_providers=None)
Link:

https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api

get_orders(self, **kwargs) ApiResponse

Returns orders created or updated during the time frame indicated by the specified parameters. You can also apply a range of filtering criteria to narrow the list of orders returned. If NextToken is present, that will be used to retrieve the orders instead of other criteria.

Usage Plan:

Rate (requests per second)

Burst

1

1

For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.

Examples

literal blocks:

Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
Parameters:
  • CreatedAfter (key) – date

  • CreatedBefore (key) – date

  • LastUpdatedAfter (key) – date

  • LastUpdatedBefore (key) – date

  • OrderStatuses (key) – [str]

  • MarketplaceIds (key) – [str]

  • FulfillmentChannels (key) – [str]

  • PaymentMethods (key) – [str]

  • BuyerEmail (key) – str

  • SellerOrderId (key) – str

  • MaxResultsPerPage (key) – int

  • EasyShipShipmentStatuses (key) – [str]

  • NextToken (key) – str

  • AmazonOrderIds (key) – [str]

  • RestrictedResources (key) – [str]

Return type:

ApiResponse

get_order(self, order_id: str, **kwargs) ApiResponse

Returns the order indicated by the specified order ID.

Usage Plan:

Rate (requests per second)

Burst

1

1

For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.

Examples

literal blocks:

Orders().get_order('TEST_CASE_200')
Parameters:
  • order_id – str

  • RestrictedResources (key) – [str]

  • **kwargs

Return type:

ApiResponse

get_order_items(self, order_id: str, **kwargs) ApiResponse

Returns detailed order item information for the order indicated by the specified order ID. If NextToken is provided, it’s used to retrieve the next page of order items.

Note: When an order is in the Pending state (the order has been placed but payment has not been authorized), the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or promotions for the order items in the order. After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping charges, gift status and promotions for the order items in the order.

Usage Plan:

Rate (requests per second)

Burst

1

1

For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.

Examples

literal blocks:

Orders().get_order_items('TEST_CASE_200')
Parameters:
  • order_id – str

  • RestrictedResources (key) – [str]

  • **kwargs

Return type:

ApiResponse

get_order_address(self, order_id, **kwargs) ApiResponse

Returns the shipping address for the order indicated by the specified order ID.

Note:

To get useful information from this method, you need to have access to PII.

Usage Plan:

Rate (requests per second)

Burst

1

1

Examples

Orders().get_order_address(‘TEST_CASE_200’)

Parameters:
  • order_id – str

  • **kwargs

Returns:

ApiResponse

get_order_buyer_info(self, order_id: str, **kwargs) ApiResponse

Returns buyer information for the order indicated by the specified order ID.

Note:

To get useful information from this method, you need to have access to PII.

Usage Plan:

Rate (requests per second)

Burst

1

1

For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.

Examples

Orders().get_order_buyer_info(‘TEST_CASE_200’)

Parameters:
  • order_id – str

  • **kwargs

Return type:

GetOrderBuyerInfoResponse

get_order_items_buyer_info(self, order_id: str, **kwargs) ApiResponse

Returns buyer information in the order items of the order indicated by the specified order ID.

Usage Plan:

Rate (requests per second)

Burst

1

1

For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.

Examples

literal blocks:

Orders().get_order_items_buyer_info('TEST_CASE_200')
Parameters:
  • order_id – str

  • NextToken (key) – str | retrieve data by next token

Returns:

ApiResponse

update_shipment_status(self, order_id: str, **kwargs) ApiResponse

Update the shipment status. Usage Plan: ====================================== ============== Rate (requests per second) Burst ====================================== ============== 5 15 ====================================== ============== For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation. .. admonition:: Examples

literal blocks::
Orders().update_shipment_status(

order_id=’123-1234567-1234567’, marketplaceId=’ATVPDKIKX0DER’, shipmentStatus=’ReadyForPickup’

)

Parameters:

order_id – str

Returns:

ApiResponse

confirm_shipment(self, order_id: str, **kwargs) ApiResponse

Updates the shipment confirmation status for a specified order. Usage Plan: ====================================== ============== Rate (requests per second) Burst ====================================== ============== 2 10 ====================================== ============== For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation. .. admonition:: Examples

literal blocks::
Orders().confirm_shipment(

order_id=’123-1234567-1234567’, marketplaceId=’ATVPDKIKX0DER’, packageDetail={

‘packageReferenceId’: ‘0001’, ‘carrierCode’: ‘DHL’, “shippingMethod”: ‘Paket’, ‘trackingNumber’: ‘1234567890’, ‘shipDate’: ‘2023-03-19T12:00:00Z’, ‘orderItems’: [

{

‘orderItemId’: ‘123456789’, ‘quantity’: 1

}, {

‘orderItemId’: ‘2345678901’, ‘quantity’: 2

},

]

}

)

Parameters:

order_id – str

Returns:

ApiResponse

Restricted Data Token

To use a restricted data token to access PII data, you can pass the token obtained from the Token endpoint to the client:

Orders(restricted_data_token='......').get_orders(...)