updateOrder

Version 2024-11-01

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Update a BwP Order.

ℹ️

Required scope(s)

Edit Order Data

Response

Return type UpdateOrderResponse

Arguments

ArgumentDescription
input (UpdateOrderInput required)

Specifies the input fields to update an Order.

orderIdentifier (OrderIdentifierInput required)

Identifier of the order to update. This could be the Buy with Prime id or any valid aliases for the order.

Examples


Update Return Without Alias

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { returns: { details: [ { returnIdentifier: { id: "return-id-1" } state: CANCELLED } ] } } ) { order { id returns { details { id createdAt updatedAt aliases { aliasId aliasType } state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz789", "updatedAt": "xyz790", "state": "CANCELLED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-1" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Update Return With Alias

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { returns: { details: [ { returnIdentifier: { alias: { aliasType: "EXTERNAL-RETURN-ID", aliasId: "external-return-id-1" } } state: CANCELLED } ] } } ) { order { id returns { details { id createdAt updatedAt aliases { aliasType aliasId } state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz789", "updatedAt": "xyz790", "state": "CANCELLED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-1" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Update Refund With Alias Id

Request

mutation updateOrder{ updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { refunds: { details: [ { id: "external-refund-id-1" aliases: [ { aliasType: "EXTERNAL_REFUND_ID" aliasId: "external-refund-id-1" } ] refundTotal: { totalAmount: { amount: 10 currencyCode: "USD" } } state: SUCCESS refundFor: { orderLineItems: [ { lineItemId: { lineItemId: "1234567" } refundedQuantity: { amount: 1.0 } } ] } paymentDetails: [ { id: "payment-transfer-id-1" amount: { amount: 10 currencyCode: "USD" } paymentMethod: { displayString: "Visa ending in 1234" type: AMAZON_PAY } state: SUCCESS payer: { id: "payer-id-1" billingAddress: { name: "John Smith" streetAddress: "399 Boren Ave N" locality: "Seattle" region: "WA" countryCode: "US" postalCode: "98019" contactNumber: "123-456-7890" } contact: { emailData: { name: "John Smith" email: "john_smith_01@gmail.com" } } } } ] } ] } } ) { order { id refunds { details { id state refundRequestReason aliases { aliasType aliasId } refundTotal { totalAmount { amount currencyCode } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "refunds": { "details": [ { "id": "refund-123", "state": "SUCCESS", "refundRequestReason": "CANCELLED_ORDER", "aliases": [ { "aliasType": "EXTERNAL_REFUND_ID", "aliasId": "external-refund-id-1" } ], "refundTotal": { "totalAmount": { "amount": 10, "currencyCode": "USD" } } } ] } } } } }

Update Refund

Request

mutation updateOrder{ updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { refunds: { details: [ { id: "refund-123" aliases: [ { aliasType: "EXTERNAL_REFUND_ID" aliasId: "external-refund-id-1" } ] refundTotal: { totalAmount: { amount: 10 currencyCode: "USD" } } state: SUCCESS refundFor: { orderLineItems: [ { lineItemId: { lineItemId: "1234567" } refundedQuantity: { amount: 1.0 } } ] } paymentDetails: [ { id: "payment-transfer-id-1" amount: { amount: 10 currencyCode: "USD" } paymentMethod: { displayString: "Visa ending in 1234" type: AMAZON_PAY } state: SUCCESS payer: { id: "payer-id-1" billingAddress: { name: "John Smith" streetAddress: "399 Boren Ave N" locality: "Seattle" region: "WA" countryCode: "US" postalCode: "98019" contactNumber: "123-456-7890" } contact: { emailData: { name: "John Smith" email: "john_smith_01@gmail.com" } } } } ] } ] } } ) { order { id refunds { details { id state refundRequestReason aliases { aliasType aliasId } refundTotal { totalAmount { amount currencyCode } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "refunds": { "details": [ { "id": "refund-123", "state": "SUCCESS", "refundRequestReason": "CANCELLED_ORDER", "aliases": [ { "aliasType": "EXTERNAL_REFUND_ID", "aliasId": "external-refund-id-1" } ], "refundTotal": { "totalAmount": { "amount": 10, "currencyCode": "USD" } } } ] } } } } }

Update Multiple Returns

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { returns: { details: [ { returnIdentifier: { id: "return-id-1" }, state: CANCELLED }, { returnIdentifier: { id: "return-id-2" }, state: CANCELLED } ] } } ) { order { id returns { details { id createdAt updatedAt aliases { aliasType aliasId } state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz89", "updatedAt": "xyz90", "state": "CANCELLED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-1" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItems": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] }, { "id": "return-id-2", "createdAt": "xyz89", "updatedAt": "xyz90", "state": "CANCELLED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-2" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "765-4321", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Sync Return Without Alias

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { returns: { details: [ { state: CREATED, returnLineItems: [ { returnFor: { orderLineItemAmounts: [ { amount: { value: 1.0 }, lineItemId: { lineItemId: "1234567" } } ] } } ] } ] } } ) { order { id returns { details { id createdAt updatedAt state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz789", "updatedAt": "xyz789", "state": "CREATED", "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Sync Return With Alias

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { returns: { details: [ { aliases: [ { aliasType: "EXTERNAL-RETURN-ID", aliasId: "external-return-id-1" } ], state: CREATED, returnLineItems: [ { returnFor: { orderLineItemAmounts: [ { amount: { value: 1.0 }, lineItemId: { lineItemId: "1234567" } } ] } } ] } ] } } ) { order { id returns { details { id createdAt updatedAt aliases { aliasType aliasId } state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz789", "updatedAt": "xyz789", "state": "CREATED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-1" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Sync Refund

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { refunds: { details: [ { aliases: [ { aliasType: "externalRefundId", aliasId: "external-refund-id-1" } ] refundTotal: { totalAmount:{ amount: 3, currencyCode: "USD" } } refundFor: { orderLineItems: [ { lineItemId: { lineItemId: "1234567" } refundedQuantity: { amount: 1.0 } } ] } state: SUCCESS refundRequestReason: DAMAGED_DEFECTIVE_ITEM } ] } } ) { order { id refunds { details { id state refundRequestReason aliases { aliasType aliasId } refundTotal { totalAmount { amount } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "refunds": { "details": [ { "id": "refund-123", "state": "SUCCESS", "refundRequestReason": "DAMAGED_DEFECTIVE_ITEM", "aliases": [ { "aliasType": "externalRefundId", "aliasId": "external-refund-id-1" } ], "refundTotal": { "totalAmount": { "amount": 3 } } } ] } } } } }

Sync Multiple Returns

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "12345678910" } input: { returns: { details: [ { aliases: [ { aliasType: "EXTERNAL-RETURN-ID", aliasId: "external-return-id-1" } ], returnLineItems: [ { returnFor: { orderLineItemAmounts: [ { amount: { value: 1.0 }, lineItemId: { lineItemId: "1234567" } } ] } } ] }, { aliases: [ { aliasType: "EXTERNAL-RETURN-ID", aliasId: "external-return-id-2" } ], state: CREATED, returnLineItems: [ { returnFor: { orderLineItemAmounts: [ { amount: { value: 1.0 }, lineItemId: { lineItemId: "7654321" } } ] } } ] } ] } } ) { order { id returns { details { id createdAt updatedAt aliases { aliasType aliasId } state returnLineItems { id returnFor { orderLineItemAmounts { amount { value } lineItem { id amount { value } } } } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "returns": { "details": [ { "id": "return-id-1", "createdAt": "xyz89", "updatedAt": "xyz89", "state": "CREATED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-1" } ], "returnLineItems": [ { "id": "return-line-item-1", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "123-4567", "amount": { "value": 1.0 } } } ] } } ] }, { "id": "return-id-2", "createdAt": "xyz89", "updatedAt": "xyz89", "state": "CREATED", "aliases": [ { "aliasType": "EXTERNAL-RETURN-ID", "aliasId": "external-return-id-2" } ], "returnLineItems": [ { "id": "return-line-item-2", "returnFor": { "orderLineItemAmounts": [ { "amount": { "value": 1.0 }, "lineItem": { "id": "765-4321", "amount": { "value": 1.0 } } } ] } } ] } ] } } } } }

Reject Refund

Request

mutation updateOrder { updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { refunds: { details: [ { aliases: [ { aliasType: "externalRefundId", aliasId: "external-refund-id-1" } ] refundTotal: { totalAmount:{ amount: 0, currencyCode: "USD" } } state: REJECTED refundStatusReason: REFUND_ALREADY_PROCESSED } ] } } ) { order { id refunds { details { id state refundRequestReason refundStatusReason aliases { aliasType aliasId } refundTotal { totalAmount { amount } } } } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "123-4567-8910", "refunds": { "details": [ { "id": "refund-123", "state": "REJECTED", "refundRequestReason": "CANCELLED_ORDER", "refundStatusReason": "REFUND_ALREADY_PROCESSED", "aliases": [ { "aliasType": "externalRefundId", "aliasId": "external-refund-id-1" } ], "refundTotal": { "totalAmount": { "amount": 0 } } } ] } } } } }

Initiate Fulfilment With All Order Details

Request

mutation updateOrder{ updateOrder( orderIdentifier: { orderId: "322-ABC1-AAAAAA" } input: { lineItems: [ { id: { lineItemId: "example-line-item-id" } aliases: [ { aliasType: "ID" aliasId: "123-456" } { aliasType: "EXTERNAL_ITEM_ID" aliasId: "external-line-item-id-123-456" } { aliasType: "SKU" aliasId: "sku-id-123-456" } ] discounts: { summary: { amount: { amount: 2.8 currencyCode: "USD" } displayString: "TENPERCENTOFF" } } payments: { details: [ { id: "payment-id-1" amount: { amount: 38.79 currencyCode: "USD" } paymentMethod: { displayString: "Visa ending in 1234" type: AMAZON_PAY } state: SUCCESS payer: { id: "payer-id-1" billingAddress: { name: "John Smith" streetAddress: "399 Boren Ave N" locality: "Seattle" region: "WA" countryCode: "US" postalCode: "98019" contactNumber: "123-456-7890" } contact: { emailData: { name: "John Smith" email: "john_smith_01@gmail.com" } } } } ] } taxes: { summary: { collectableTaxAmount: { amount: 1.02 currencyCode: "USD" } } } } ] aliases: [ { aliasType: "ID" aliasId: "123-456" } { aliasType: "EXTERNAL_ITEM_ID" aliasId: "external-line-item-id-123-456" } ] packageInformation: { details: [ { aliases:[ { aliasType: "EXTERNAL_ID" aliasId: "123-456" } ] id: "123-456" } ] } payments: { details: [ { id: "payment-transfer-id-1" amount: { amount: 10 currencyCode: "USD" } paymentMethod: { displayString: "Visa ending in 1234" type: AMAZON_PAY } state: SUCCESS payer: { id: "payer-id-1" billingAddress: { name: "John Smith" streetAddress: "399 Boren Ave N" locality: "Seattle" region: "WA" countryCode: "US" postalCode: "98019" contactNumber: "123-456-7890" } contact: { emailData: { name: "John Smith" email: "john_smith_01@gmail.com" } } } } ] } totalPrice: { value: { amount: 10, currencyCode: "USD" } } desiredExecutionState: STARTED taxes: { summary: { collectableTaxAmount: { amount: 10 currencyCode: "USD" } } } discounts: { summary: { amount: { amount: 2.8 currencyCode: "USD" } displayString: "TENPERCENTOFF" } } refunds: { details: [ { aliases: [ { aliasType: "bwpRefundId" aliasId: "843b87994c961221fc5f821b84d58e00944cca922b39f3873f914dc5b5834e9e" } { aliasType: "EXTERNAL_REFUND_ID" aliasId: "external-refund-id-1" } ] refundTotal: { totalAmount: { amount: 10 currencyCode: "USD" } } state: SUCCESS refundFor: { orderLineItems: [ { lineItemId: { lineItemId: "ofmmgl63ta8u14" } } ] } paymentDetails: [ { id: "payment-transfer-id-1" amount: { amount: 10 currencyCode: "USD" } paymentMethod: { displayString: "Visa ending in 1234" type: AMAZON_PAY } state: SUCCESS payer: { id: "payer-id-1" billingAddress: { name: "John Smith" streetAddress: "399 Boren Ave N" locality: "Seattle" region: "WA" countryCode: "US" postalCode: "98019" contactNumber: "123-456-7890" } contact: { emailData: { name: "John Smith" email: "john_smith_01@gmail.com" } } } } ] } ] } orderLinks: [ { destinationType: EXTERNAL_ORDER_MANAGEMENT url: "https://mystore123.com/orders/512968435" } ] returns: { details: [ { aliases: [ { aliasType: "ID" aliasId: "123-456" } ] } ] } } ) { order { id lineItems { amount { unit value } createdAt product { title } } aliases { aliasType aliasId } } } }

Response

{ "data": { "updateOrder": { "order": { "id": "322-ABC1-AAAAAA", "lineItems": [ { "amount": { "unit": "ONE", "value": 1 }, "createdAt": "2022-02-22T16:13:11.798Z", "product": { "title": "example-product-title", "price": { "currencyCode": "USD", "amount": 10 } } } ], "aliases": [ { "aliasType": "ID", "aliasId": "123-456" }, { "aliasType": "EXTERNAL_ITEM_ID", "aliasId": "external-line-item-id-123-456" } ] } } } }

Initiate Fulfillment With Order Id

Request

mutation updateOrder{ updateOrder( orderIdentifier: { orderId: "123-4567-8910" } input: { desiredExecutionState: STARTED } ) { order { id } } }

Response

{ "data": { "updateOrder": { "order": { "id": "322-ABC1-AAAAAA" } } } }

Initiate Fulfillment With Alias

Request

mutation updateOrder{ updateOrder( orderIdentifier: { alias: { aliasType: "EXTERNAL_ID" aliasId: "123-4567-8910" } } input: { desiredExecutionState: STARTED } ) { order { id } } }

Response

{ "data": { "updateOrder": { "order": { "id": "322-ABC1-AAAAAA" } } } }


Did this page help you?