订单 API v0 用例指南
改进订单库存同步、工作流程和报告工具。
API 版本:v0
什么是订单 API?
Use the Orders API to programmatically retrieve and submit order information. This API is designed to help Selling Partners develop fast and flexible custom applications that facilitate order synchronization, order research, and demand-based decision support tools.
注意
两年以上的订单不会显示在 API 响应中,但新加坡、日本和澳大利亚商城除外,这些商城支持 2016 年及以后的订单。
For information about authentication and authorization, refer to Authorizing Selling Partner API Applications. For information about regulated orders, refer to the Regulated Orders guide.
主要功能
- 使用筛选条件检索订单信息: 那个
getOrders
Orders API 的操作会返回在指定参数指示的时间段内创建或更新的订单。如果NextToken
存在,它用于检索订单,而不是其他标准。 - 检索指定的订单信息:订单 API 的
getOrder
操作会返回您指定的订单信息。 - 检索指定订单的订单商品信息:订单 API 的
getOrderItems
操作会返回您指定订单的详细订单商品信息。如果提供了NextToken
,它将用于检索下一页的订单商品。 - 确认指定订单的货件:订单 API 的
confirmShipment
操作可确认指定订单的货件状态。它还可用于编辑已发货订单的货件详情。
教程 1:使用筛选条件检索订单信息
The getOrders
operation of the Orders API returns orders created or updated during the time frame or other filtering criteria indicated by the specified parameters. If NextToken
is present, that will be used to retrieve the orders instead of other criteria.
请注意
getOrders
操作在数据检索方面有系统延迟。大多数更新的订单数据将在订单创建或最后更新 2 分钟侯可用。为确保检索的是最新的订单数据,请在创建或更新订单 2 分钟后调用该操作。
先决条件
要成功完成本教程,您必须:
- Authorization from the selling partner for whom you are making calls. Refer to the Authorizing Selling Partner API applications for more information.
- Approval for the Inventory and Order Tracking role in your developer profile.
- The Inventory and Order Tracking role selected in the App registration page for your application.
要访问买家和配送地址信息,您必须:
-
获得以下职位的批准:
- Direct-to-Consumer Delivery (Restricted) role is required to access shipping address information.
- The Tax Remittance (Restricted) role is required to access buyer information.
- The Tax Invoicing (Restricted) role is required to access buyer information.
-
使用受限数据令牌 (RDT)
- Follow the Tutorial: Get authorization to access PII for bulk orders to get an RDT that provides authorization to access Personally Identifiable Information (PII) for bulk orders.
- Use any of the following values in the
dataElements
parameter in thecreateRestrictedDataToken
operation to access thegetOrders
operation:buyerInfo
shippingAddress
buyerTaxInformation
getOrders 请求
Call the getOrders
operation.
查询参数
名称 | 描述 | 必填项 |
---|---|---|
CreatedAfter | 用于选择在指定时间之后(或当时)创建的订单的日期。只有在指定时间之后下的订单才会被返回。您必须提供 CreatedAfter 参数或 LastUpdatedAfter 参数。如果两者都为空,则调用无效。 | 没有帮助 |
CreatedBefore | A date used for selecting orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in ISO 8601 format. | 没有帮助 |
LastUpdatedAfter | A date used for selecting orders that were last updated after (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. You must provide either the CreatedAfter parameter or the LastUpdatedAfter parameter. If both are empty the call is invalid. | 没有帮助 |
LastUpdatedBefore | A date used for selecting orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. | 没有帮助 |
OrderStatuses | 用于筛选结果的 OrderStatus 值的列表。可能的值: - PendingAvailability (此状态仅适用于预购商品。订单已下单,付款未获授权,商品的发布日期是将来的日期。)- Pending (订单已下单,但付款未获授权。)- Unshipped (付款已获授权,订单已准备好发货,但订单中的任何商品尚未发货。)- PartiallyShipped (订单中的一件或多件商品 [但不是全部] 已发货。)- Shipped (订单中的所有商品均已发货。)- InvoiceUnconfirmed (订单中的所有商品均已发货。卖家尚未向亚马逊确认发票已发送给买家。)- Canceled (订单已取消。)- Unfulfillable (订单无法配送。此状态仅适用于多渠道配送订单。) | 没有帮助 |
MarketplaceIds | A list of MarketplaceId values. Used to select orders that were placed in the specified marketplaces.br>Refer to Marketplace IDs for a complete list of marketplaceId values.Max count : 50 | 有帮助 |
FulfillmentChannels | 显示订单配送方式的列表。按配送渠道筛选结果。可能的值:AFN(亚马逊物流);MFN(卖家自配送)。 | 没有帮助 |
PaymentMethods | 付款方式值列表。用于选择使用指定付款方式支付的订单。可能的值:COD(货到付款);CVS(便利店付款);其他(货到付款或 CVS 以外的任何付款方式)。 | 没有帮助 |
BuyerEmail | 买家的电子邮件地址。用于选择包含指定电子邮件地址的订单。 | 没有帮助 |
SellerOrderId | 卖家指定的订单标识符。用于仅选择与订单标识符匹配的订单。如果指定了 SellerOrderId ,泽无法指定 FulfillmentChannels 、OrderStatuses 、PaymentMethod 、LastUpdatedAfter 、LastUpdatedBefore 和 BuyerEmail 。 | 没有帮助 |
MaxResultsPerPage | 表示每页可以返回的最大订单数的数字。值必须为 1-100。默认为 100。 | 没有帮助 |
EasyShipShipmentStatuses | EasyShipShipmentStatus 值的列表。用于选择状态与指定值匹配的 Easy Ship 订单。如果指定了 EasyShipShipmentStatus ,则仅返回亚马逊 Easy Ship 订单。可能的值: - PendingSchedule (包裹正在等待取货时间表。)- PendingPickUp (亚马逊尚未从卖家那里取货。)- PendingDropOff (卖家将把包裹配送给承运人。)- LabelCanceled (卖家取消了取货。)- PickedUp (亚马逊已从卖家那里取货。)- DroppedOff (包裹由卖家配送给承运人。)- AtOriginFC (包裹在原产地运营中心。)- AtDestinationFC (包裹在目的地运营中心。)- Delivered (包裹已送达。)- RejectedByBuyer (包裹已被买家拒收。)- Undeliverable (包裹无法送达。)- ReturningToSeller (包裹未送达,正在退还给卖家。)- ReturnedToSeller (包裹未送达,已退还给卖家。)- Lost (包裹丢失。)- OutForDelivery (包裹已发货。)- Damaged (包裹被承运人损坏。) | 没有帮助 |
ElectronicInvoiceStatuses | ElectronicInvoiceStatus 值的列表。用于选择电子发票状态与指定值匹配的订单。可能的值: - NotRequired (此订单无需提交电子发票。)- NotFound (此订单的电子发票未提交。)- Processing (正在处理此订单的电子发票。)- Errored (此订单上次提交的电子发票被拒绝。)- Accepted (上次提交的电子发票已提交并被接受。) | 没有帮助 |
NextToken | 在响应上一个请求时返回的字符串令牌。 | 没有帮助 |
AmazonOrderIds | AmazonOrderId 值的列表。AmazonOrderId 是亚马逊定义的订单标识符,采用 3-7-7 格式。最大计数:50 | 没有帮助 |
ActualFulfillmentSupplySourceId | 表示推荐的 sourceId 订单应从哪里发货。 | 没有帮助 |
IsISPU | 如果为 true,则此订单将标记为从商店取货,而不是送达。 | 没有帮助 |
StoreChainStoreId | 连锁商店标识符。关联连锁店中的特定商店。 | 没有帮助 |
请求示例
GET https://sellingpartnerapi-eu.amazon.com/orders/v0/orders?
MarketplaceIds=ATVPDKIKX0DER
&CreatedAfter=2020-10-10
&MaxResultPerPage=2
响应
成功的响应包括以下内容:
名称 | 描述 | 必填项 |
---|---|---|
Orders | A list of orders. Type: Order array | 有帮助 |
NextToken | 如果存在且不为空,则在下一个请求中传递此字符串令牌以返回下一个响应页面。 | 没有帮助 |
LastUpdatedBefore | A date used for selecting orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. All dates must be in ISO 8601 format. | 没有帮助 |
CreatedBefore | A date used for selecting orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in ISO 8601 format. | 没有帮助 |
响应示例
以下是来自的一般回应示例 getOrders
操作。
{
"payload": {
"NextToken": "2YgYW55IGNhcm5hbCBwbGVhc3VyZS4",
"Orders": [
{
"AmazonOrderId": "902-3159896-1390916",
"PurchaseDate": "2017-01-20T19:49:35Z",
"LastUpdateDate": "2017-01-20T19:49:35Z",
"OrderStatus": "Pending",
"FulfillmentChannel": "SellerFulfilled",
"NumberOfItemsShipped": 0,
"NumberOfItemsUnshipped": 0,
"PaymentMethod": "Other",
"PaymentMethodDetails": [
"CreditCard",
"GiftCertificate"
],
"MarketplaceId": "ATVPDKIKX0DER",
"ShipmentServiceLevelCategory": "Standard",
"OrderType": "StandardOrder",
"EarliestShipDate": "2017-01-20T19:51:16Z",
"LatestShipDate": "2017-01-25T19:49:35Z",
"IsBusinessOrder": false,
"IsPrime": false,
"IsAccessPointOrder": false,
"IsGlobalExpressEnabled": false,
"IsPremiumOrder": false,
"IsSoldByAB": false,
"IsIBA": false,
"ShippingAddress": {
"Name": "Michigan address",
"AddressLine1": "1 Cross St.",
"City": "Canton",
"StateOrRegion": "MI",
"PostalCode": "48817",
"CountryCode": "US"
},
"BuyerInfo": {
"BuyerEmail": "user@example.com",
"BuyerName": "John Doe",
"BuyerTaxInfo": {
"CompanyLegalName": "A Company Name"
},
"PurchaseOrderNumber": "1234567890123"
}
}
]
}
}
当订单配送到巴西地址时,您可能还会收到其他地址字段(例如,街道名称、街道号码、补码和邻里),如以下示例所示。
{
"ShippingAddress": {
"Name": "Brazil address",
"AddressLine1": "Street 9 450",
"AddressLine2": "Suite 30 Central",
"ExtendedFields": {
"StreetName": "Street 9",
"StreetNumber": "450",
"Complement": "Suite 30",
"Neighborhood": "Central"
},
"City": "Rio de Janeiro",
"StateOrRegion": "RJ",
"PostalCode": "48817",
"CountryCode": "BR"
}
}
For more information on when shipping addresses contain extended fields, refer to the Order
schema in the Orders API v0 reference.
For a list of possible extended fields, refer to AddressExtendedFields
in the Orders API v0 reference.
教程 2:检索订单信息
The tutorial shows you how to use the getOrder
operation of the Orders API to retrieve order information that you specify.
先决条件
要成功完成本教程,您必须:
- Authorization from the selling partner for whom you are making calls. Refer to the Authorizing Selling Partner API applications for more information.
- Approval for the Inventory and Order Tracking role in your developer profile.
- The Inventory and Order Tracking role selected in the App registration page for your application.
要访问买家和配送地址信息,您必须:
-
获得以下职位的批准:
- Direct-to-Consumer Delivery (Restricted) role is required to access shipping address information.
- The Tax Remittance (Restricted) role is required to access buyer information.
- The Tax Invoicing (Restricted) role is required to access buyer information.
-
使用受限数据令牌 (RDT):
- Follow the Tokens API Use Case Guide to get an RDT that provides authorization to access Personally Identifiable Information (PII) for an operation.
- Use any of the following values in the
dataElements
parameter in thecreateRestrictedDataToken
operation to access thegetOrder
operation:buyerInfo
shippingAddress
buyerTaxInformation
请求
参数 | 描述 | 必填项 |
---|---|---|
orderId
|
亚马逊定义的订单编码,采用 3-7-7 格式。 类型:字符串 |
有帮助 |
请求示例
GET https://sellingpartnerapi-eu.amazon.com/orders/v0/orders/205-1725759-9209952/
响应
成功的响应包括以下内容:
名称 | 描述 | 必填项 |
---|---|---|
Order | Order information. Type: Order | 有帮助 |
Refer to Order
in the API reference for details about the possible objects and properties in an order.
响应示例
{
"payload": {
"BuyerInfo": {},
"AmazonOrderId": "026-1520163-6049104",
"EarliestShipDate": "2022-03-10T00:00:00Z",
"SalesChannel": "Amazon.co.uk",
"AutomatedShippingSettings": {
"HasAutomatedShippingSettings": false
},
"OrderStatus": "Canceled",
"NumberOfItemsShipped": 0,
"OrderType": "StandardOrder",
"IsPremiumOrder": false,
"IsPrime": false,
"FulfillmentChannel": "MFN",
"NumberOfItemsUnshipped": 0,
"HasRegulatedItems": true,
"IsReplacementOrder": false,
"IsSoldByAB": false,
"LatestShipDate": "2022-03-10T23:59:59Z",
"ShipServiceLevel": "Std UK Dom_1",
"IsISPU": false,
"MarketplaceId": "A1F83G8C2ARO7P",
"PurchaseDate": "2022-03-09T22:03:02Z",
"IsAccessPointOrder": false,
"IsBusinessOrder": false,
"OrderTotal": {
"CurrencyCode": "GBP",
"Amount": "20.00"
},
"PaymentMethodDetails": [
"Standard"
],
"IsGlobalExpressEnabled": false,
"LastUpdateDate": "2022-03-14T22:05:14Z",
"ShipmentServiceLevelCategory": "Standard"
}
}
教程 3:检索详细的订单商品信息
The tutorial shows you how to use the getOrderItems
operation of the Orders API to retrieve order information that you specify.
先决条件
要成功完成本教程,您必须:
- Authorization from the selling partner for whom you are making calls. Refer to the Authorizing Selling Partner API applications for more information.
- Approval for the Inventory and Order Tracking role in your developer profile.
- The Inventory and Order Tracking role selected in the App registration page for your application.
要访问买家和配送地址信息,您必须:
-
获得以下职位的批准:
- Direct-to-Consumer Delivery (Restricted) role is required to access shipping address information.
- The Tax Remittance (Restricted) role is required to access buyer information.
- The Tax Invoicing (Restricted) role is required to access buyer information.
-
使用受限数据令牌 (RDT)
- Follow the Tutorial: Get authorization to access PII for the order items in an order to get an RDT that provides authorization to access Personally Identifiable Information (PII) for the order items in an order.
- Use
buyerInfo
as a value in thedataElements
parameter in thecreateRestrictedDataToken
operation to access thegetOrderItems
operation.
请求
Type | 参数 | 描述 | 必填项 |
---|---|---|---|
Path |
orderId
|
亚马逊定义的订单编码,采用 3-7-7 格式。 类型:字符串 |
有帮助 |
Query |
NextToken
|
在响应上一个请求时返回的字符串令牌。 类型:字符串 |
没有帮助 |
请求示例
GET https://sellingpartnerapi-na.amazon.com/orders/v0/orders/902-9855239-8990202/orderItems
响应
成功的响应包括以下内容:
名称 | 描述 | 必填项 |
---|---|---|
OrderItems | A list of order items. Type: OrderItem array | 有帮助 |
NextToken | 如果存在且不为空,则在下一个请求中传递此字符串令牌以返回下一个响应页面。 | 没有帮助 |
AmazonOrderId | 亚马逊定义的订单编码,采用 3-7-7 格式。 | 有帮助 |
响应示例
{
"payload": {
"OrderItems": [
{
"TaxCollection": {
"Model": "MarketplaceFacilitator",
"ResponsibleParty": "Amazon Services, Inc."
},
"ProductInfo": {
"NumberOfItems": "1"
},
"BuyerInfo": {},
"ItemTax": {
"CurrencyCode": "USD",
"Amount": "1.13"
},
"QuantityShipped": 1,
"BuyerRequestedCancel": {
"IsBuyerRequestedCancel": "false",
"BuyerCancelReason": ""
},
"ItemPrice": {
"CurrencyCode": "USD",
"Amount": "11.00"
},
"ASIN": "B004RKQM8I",
"SellerSKU": "AN-M9GI-4QE5",
"Title": "Sony MDR-ZX100 ZX Series Headphones (White)",
"IsGift": "false",
"ConditionSubtypeId": "Acceptable",
"IsTransparency": false,
"QuantityOrdered": 1,
"PromotionDiscountTax": {
"CurrencyCode": "USD",
"Amount": "0.00"
},
"ConditionId": "Used",
"PromotionDiscount": {
"CurrencyCode": "USD",
"Amount": "0.00"
},
"OrderItemId": "43345934312798"
}
],
"AmazonOrderId": "902-0300094-5705429"
}
}
教程 4:确认发货
本教程将向您展示如何在收到订单已准备好配送的通知后通过 confirmShipment
操作确认货件。如果您通过配送 API 或购买配送 UI 购买货件标签,则无需确认货件。confirmShipment
操作支持订单配送上传数据中支持的所有用例,包括支持每个订单的多个追踪 ID。要提交多个包裹追踪 ID,您需要发送多个具有相同订单 ID 但不同包裹参考 ID 的请求。
示例:
Call
|
OrderID
|
PackageReferenceId
|
---|---|---|
第 1 次调用 | 902-0300094-570542 | 101 |
第 2 次调用 | 902-0300094-570542 | 102 |
包裹参考 ID 支持任何正数值,用于在确认货件后编辑货件。您可以提交任何数值作为 packageReferenceID
,我们将存储该数据。如果您需要对货件进行编辑,请使用相同的 packageReferenceID
提交另一个 confirmShipment
操作。提交成功后,其他货件详情将被编辑。如果您在提交时没有输入任何 ID,亚马逊将自动分配一个 packageReferenceID
。
先决条件
要成功完成本教程,您必须:
- Authorization from the selling partner for whom you are making calls. Refer to the Authorizing Selling Partner API applications for more information.
- Approval for the Inventory and Order Tracking role in your developer profile.
- The Inventory and Order Tracking role selected in the App registration page for your application.
If you have been approved for the Direct-to-Consumer Delivery (Restricted) role, you will have access to the confirmShipment
operation.
步骤 1. 确认一个订单的货件
Call the confirmShipment
operation, passing the following parameters:
路径参数
参数 | 描述 | 必填项 |
---|---|---|
orderId
|
亚马逊定义的订单编码,采用 3-7-7 格式。 类型:字符串 |
有帮助 |
主体参数
名称 | 描述 | 必填项 |
---|---|---|
packageDetail | Properties of packages Type PackageDetail | 有帮助 |
codCollectionMethod | The cod collection method, support in JP only. Type CodCollectionMethod | 没有帮助 |
marketplaceId | The unobfuscated marketplace identifier. Type MarketplaceId | 有帮助 |
请求示例
POST https://sellingpartnerapi-eu.amazon.com/orders/v0/orders/205-1725759-9209952/shipmentConfirmation
{
"marketplaceId": "ATVPDKIKX0DER",
"codCollectionMethod": "",
"packageDetail": {
"packageReferenceId": "123",
"carrierCode": "UPS",
"carrierName": "UPS",
"shippingMethod": "SHIPPING",
"trackingNumber": "1Z86V8030385598957",
"shipDate": "2022-11-30T16:15:30Z",
"shipFromSupplySourceId": "057d3fcc-b750-419f-bbcd-4d340c60c430",
"orderItems": [
{
"orderItemId": "60696125413094",
"quantity": 1
}
]
}
}
响应
响应属性:
HTTP Code | 描述 | Schema |
---|---|---|
204 | 成功。 标头: x-amzn-RateLimit-Limit (字符串):此操作的速率限制(每秒请求数)。x-amzn-RequestId (字符串):唯一的请求引用标识符。 | 无内容 |
For error status codes, descriptions and schemas, refer to Confirm Shipment Error Response.
提示
To confirm multiple orders, use the Feeds API v2021-06-30 and pass the
POST_ORDER_FULFILLMENT_DATA
feed type. For more information, refer to Confirm multiple orders through the Order Fulfillment feed.
步骤 2. 编辑一个订单的配送信息
After Step 1, a package is created for the order. You can edit the shipping information like Ship date, Carrier, Shipping service (or Ship method), Tracking ID (supplied by the carrier) by calling the confirmShipment
operation again.
需要保持一致的参数
为确保您编辑的是相同的货件,请勿更改以下参数。
参数 | 描述 | 在 |
---|---|---|
orderId
|
亚马逊定义的订单编码,采用 3-7-7 格式。 类型:字符串 |
Path |
packageReferenceId
|
卖家提供的唯一标识符,用于唯一标识订单范围内的包裹。请注意,仅支持正数值。 类型:字符串 |
PackageDetail |
orderItemId
|
订单商品的唯一标识符。 类型:字符串 |
ConfirmShipmentOrderItem |
quantity
|
商品的数量。 类型:整数 |
ConfirmShipmentOrderItem |
请求示例
POST https://sellingpartnerapi-eu.amazon.com/orders/v0/orders/205-1725759-9209952/shipmentConfirmation
{
"marketplaceId": "ATVPDKIKX0DER",
"codCollectionMethod": "",
"packageDetail": {
"packageReferenceId": "123",
"carrierCode": "USPS",
"carrierName": "USPS",
"shippingMethod": "SHIPPING",
"trackingNumber": "1Z86V8030385598957",
"shipDate": "2022-11-30T20:15:30Z",
"shipFromSupplySourceId": "057d3fcc-b750-419f-bbcd-4d340c60c430",
"orderItems": [
{
"orderItemId": "60696125413094",
"quantity": 1
}
]
}
}
响应
响应属性:
HTTP Code | 描述 | Schema |
---|---|---|
204 | 成功。 标头: x-amzn-RateLimit-Limit (字符串):此操作的速率限制(每秒请求数)。x-amzn-RequestId (字符串):唯一的请求引用标识符。 | 无内容 |
For error status codes, descriptions and schemas, refer to Error responses and schemas.
Updated 23 days ago