Cancel a Buy with Prime Order

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

This topic provides examples of how to Create and Manage Orders.

To learn how to call the Buy with Prime API, see Call the Buy with Prime API.

Request order cancellation

This example shows how to request order cancellation.

Request
// GraphQL mutation mutation cancelOrder{ cancelOrder( orderIdentifier: { orderId: "example-order-id" } input: { aliases: [{ aliasType: "EXT_CANCEL_ID" aliasId: "example-external-cancellation-id" } ] reason: "ORDERED_BY_MISTAKE" additionalComments: "Order placed by mistake" } ) { cancellation { id aliases { aliasType aliasId } state reason additionalComments createdAt updatedAt canceledFor { orderLineItems { lineItem { id } amount { value unit } } } } } }
Response
{ "data": { "cancelOrder": { "cancellation": { "id": "example-cancellation-id", "state": "PENDING", "aliases": [ { "aliasId": "example-external-cancellation-id", "aliasType": "EXT_CANCEL_ID" } ], "reason": "ORDERED_BY_MISTAKE", "additionalComments": "Order placed by mistake", "createdAt": "2024-07-19T06:47:22.138Z", "updatedAt": "2024-07-19T06:47:22.138Z", "requestedBy": "MERCHANT", "canceledFor": { "orderLineItems": [ { "lineItem": { "id": "example-line-item-id" }, "amount": { "value": 1, "unit": "ONE" } } ] } } } } }

Request order cancellation with only an order identifier

This example shows how to request cancellation with only an order identifier.

Request
// GraphQL mutation mutation cancelOrder{ cancelOrder( orderIdentifier: { orderId: "example-order-id" } ) { cancellation { id aliases { aliasType aliasId } state reason additionalComments createdAt updatedAt canceledFor { orderLineItems { lineItem { id } amount { value unit } } } } } }
Response
{ "data": { "cancelOrder": { "cancellation": { "id": "example-cancellation-id", "state": "PENDING", "aliases": [], "reason": null, "additionalComments": null, "createdAt": "2024-07-05T18:15:53.662Z", "updatedAt": "2024-07-05T18:15:53.662Z", "requestedBy": "MERCHANT", "canceledFor": { "orderLineItems": [ { "lineItem": { "id": "example-line-item-id" }, "amount": { "value": 1, "unit": "ONE" } } ] } } } } }

Request order cancellation when your reason isn't in the reason list

This example shows how to request order cancellation and provide a cancellation reason that's not in the cancellation reason list. In this case, choose OTHER as the reason and add your reason in the note field.

Request
// GraphQL mutation mutation cancelOrder{ cancelOrder( orderIdentifier: { orderId: "example-order-id" } input: { aliases: [{ aliasType: "EXT_CANCEL_ID" aliasId: "example-external-cancellation-id" } ] reason: "OTHER" note: "DAMAGED PRODUCT" } ) { cancellation { id aliases { aliasType aliasId } state reason additionalComments createdAt updatedAt canceledFor { orderLineItems { lineItem { id } amount { value unit } } } } } }
Response
{ "data": { "cancelOrder": { "cancellation": { "id": "example-cancellation-id", "state": "PENDING", "aliases": [ { "aliasId": "cancel-ext-1", "aliasType": "external-cancellation-id" } ], "reason": "OTHER", "additionalComments": "DAMAGED PRODUCT", "createdAt": "2024-07-19T06:47:22.138Z", "updatedAt": "2024-07-19T06:47:22.138Z", "requestedBy": "MERCHANT", "canceledFor": { "orderLineItems": [ { "lineItem": { "id": "example-line-item-id" }, "amount": { "value": 1, "unit": "ONE" } } ] } } } } }

Related topics


Did this page help you?