Hub per sviluppatoriStato dell'APISupporto

Tutorial: iscriviti alla notifica ORDER_CHANGE

flusso di lavoro per iscriversi alla notifica ORDER_CHANGE

Questo tutorial spiega come usare ORDER_CHANGE notifica, che viene inviata ogni volta che si verifica una modifica dello stato di disponibilità dell'ordine. L'iscrizione a questa notifica contribuirà a ridurre il carico di lavoro di elaborazione degli ordini e a migliorare le prestazioni dell'integrazione con l'API Amazon Selling Partner.

Vantaggi del ORDER_CHANGE notifica

Le ORDER_CHANGE la notifica offre i seguenti vantaggi:

  • Informazioni sufficienti per automatizzare i flussi di lavoro successivi: Ora puoi usare ORDER_CHANGE payload per ottenere informazioni sugli ordini. La notifica è progettata anche per avvisarti nel caso in cui un acquirente richieda un annullamento.
  • Eventi per ricevere notifiche se necessario: Non sarà più necessario continuare a eseguire il polling dell'API Orders, risparmiando così la capacità del server.
  • Payload consolidato a livello di ordine: Se nell'ordine sono presenti più articoli, riceverai payload consolidati a livello di ordine. L'attivazione a livello di ordine consente di creare un flusso di lavoro di integrazione più efficiente.
  • I filtri degli eventi consentono abbonamenti filtrati: I filtri degli eventi sono ora supportati con ORDER_CHANGE notifica. Con i filtri per eventi, puoi iscriverti con un apposito OrderChangeType per filtrare le notifiche degli ordini pertinenti alla tua attività. Al momento supportiamo l'annullamento richiesto dall'acquirente e la modifica dello stato dell'ordine.
  • Filtri per eventi estensibili per casi d'uso futuri: Questa nuova notifica consente ad Amazon di aggiungere ulteriori eventi relativi agli ordini in futuro, come determinati eventi Easy Ship o eventi di ritiro a domicilio.
  • Ora della modifica aggiunta per fornire modifiche agli eventi in tempo reale: Il ORDER_CHANGE la notifica riporta l'ora della modifica dell'ordine come campo nel payload. L'implementazione di questo elemento nella tua integrazione ti consente di fornire aggiornamenti in tempo reale per i tuoi venditori.

Tutorial

Il seguente tutorial ti aiuterà a iscriverti e utilizzare il ORDER_CHANGE notifica.

Prerequisiti

Before you subscribe to the ORDER_CHANGE notification, your developer profile and app must have the Inventory and Order Tracking role or Amazon Fulfillment role assigned.

🚧

Importante:

La versione precedente di questa notifica, ORDER_STATUS_CHANGE, sono stati obsoleti. Abbonati al ORDER_CHANGE notifica ed eliminazione dell'abbonamento a ORDER_STATUS_CHANGE.

  1. Call the getSubscription operation to fetch the subscriptionId of ORDER_STATUS_CHANGE.
  2. With the subscriptionId, use the deleteSubscriptionById operation to delete the subscription to the ORDER_STATUS_CHANGE notification. Remember that the deleteSubscriptionById operation is a grantless operation.

Fase 1. Abbonati al ORDER_CHANGE notifica

  1. Crea un abbonamento a ORDER_CHANGE utilizzando direttive di elaborazione.

The processingDirective is used to pass additional information to the subscription to control the processing of notifications. For example, you can use eventFilter to filter out notifications for a specific Order Change Type.

To use eventFilter for ORDER_CHANGE notifications, make sure to include eventFilterType and orderChangeTypes in the create subscription step.

  1. Call the createSubscription operation.

  2. Add the parameter ORDER_CHANGE in the notificationType path variable.

The following payload shows how to set a filter to receive only notifications about order status changes. Make sure to include your destinationId:

POST https://sellingpartnerapi-na.amazon.com/notifications/v1/subscriptions/ORDER_CHANGE { "payloadVersion": "1.0", "destinationId": "e22gf420-1606-47c4-a393-91df6648d3da", "processingDirective": { "eventFilter": { "orderChangeTypes": [ "OrderStatusChange" ], "eventFilterType": "ORDER_CHANGE" } } }

Se la richiesta va a buon fine, riceverai questa risposta:

{ "payload": { "subscriptionId": "92d519e4-f208-493b-9092-d70cf546c383", "destinationId": "e22gf420-1606-47c4-a393-91df6648d3da", "payloadVersion": "1.0", "processingDirective": { "eventFilter": { "orderChangeTypes": [ "OrderStatusChange" ], "eventFilterType": "ORDER_CHANGE" } } } }

Se vuoi ricevere BuyerRequestedChange informazioni, è necessario includere BuyerRequestedChange nel orderChangeTypes per filtrare le notifiche pertinenti. Per ricevere notifiche sugli ordini da tutti i tipi di modifica degli ordini, aggiungi eventFilterType impostazione al momento della sottoscrizione a questa notifica.

Esempio di payload:

{ "destinationId": "e22gf420-1606-47c4-a393-91df6648d3da", "payloadVersion": "1.0", "processingDirective": { "eventFilter": { "eventFilterType": "ORDER_CHANGE" } } }

Fase 2. Ricevere messaggi di notifica

Dopo aver impostato correttamente la notifica, riceverai messaggi nella coda di Amazon Simple Queue Service (Amazon SQS) per tutte le modifiche allo stato dell'ordine.

Di seguito è riportato un esempio di ORDER_CHANGE notifica:

{ "NotificationVersion" : "1.0", "NotificationType" : "ORDER_CHANGE", "PayloadVersion" : "1.0", "EventTime" : "2023-10-03T01:35:06.382Z", "Payload" : { "OrderChangeNotification" : { "NotificationLevel" : "OrderLevel", "SellerId" : "ABCDEFGFMDKELDW", "AmazonOrderId" : "123-4567891-4567891", "OrderChangeType" : "OrderStatusChange", "OrderChangeTrigger" : { "TimeOfOrderChange" : "2023-10-03T01:35:01.000Z", "ChangeReason" : "Order Status Change" }, "Summary" : { "MarketplaceId" : "A2Q3Y263D00KWC", "OrderStatus" : "Unshipped", "PurchaseDate" : "2023-10-03T01:03:44.106Z", "DestinationPostalCode" : null, "FulfillmentType" : "MFN", "OrderType" : "StandardOrder", "OrderPrograms" : [ ], "ShippingPrograms" : [ ], "OrderItems" : [ { "OrderItemId" : "12345207241", "SellerSKU" : "SKU123", "SupplySourceId" : null, "Quantity" : 15 } ] } } }, "NotificationMetadata" : { "ApplicationId" : "amzn1.sp.solution.c4d.......", "SubscriptionId" : "52ac10........", "PublishTime" : "2023-10-03T01:35:07.931Z", "NotificationId" : "e9b0f384........" } }

When you receive a notification, check the value of OrderChangeTypes in the notification payload:

  1. BuyerRequestedChange: The buyer has initiated a cancellation. To cancel an MFN order, use the POST_ORDER_ACKNOWLEDGEMENT_DATA feed.
  2. OrderStatusChange: The order status has changed. Check the changed OrderStatus. If it is Unshipped, you can now start preparing your order to fulfill the items purchased by buyers. This is a time sensitive task; being notified in real-time helps you fulfill orders in a timely manner. After shipping the product to the customer, you are also expected to confirm the shipment to Amazon, notifying the buyer that the product is out for delivery. Refer to How to confirm MFN Orders using SP-API for more information on confirming MFN orders using Selling Partner APIs.

Il carico utile del ORDER_CHANGE la notifica ora fornisce OrderItems dal relativo ordine. Quando si utilizza il OrderItems informazioni, non è più necessario chiamare il getOrderItems operazione per sapere quali articoli sono presenti in un ordine.

Conclusione

Questo tutorial spiegava come abbonarsi e utilizzare il ORDER_CHANGE notifica, che aiuta a ridurre il carico di lavoro di elaborazione degli ordini e a migliorare le prestazioni dell'integrazione con l'API Amazon Selling Partner.


Questa pagina ti è stata utile?