updateOrder

Version 2024-01-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.

Examples


Update Refund

Request

mutation updateOrder{
    updateOrder(
        input: {
            orderId: "123-4567-8910"
            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: "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: "[email protected]"
                                        }
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        }
    ) {
        id
    }
}

Response

{
  "data": {
    "updateOrder": {
      "id": "123-4567-8910"
    }
  }
}

Initiate Fulfilment With All Order Details

Request

mutation updateOrder{
    updateOrder(
        input: {
            orderId: "123-4567-8910"
            lineItems: [
                {
                    purchasedItem: {
                        itemId: {
                            ID: "e2a20tn5wnzf95"
                        }
                        title: "Best Pet Supplies - Waterproof Dogs toys"
                        price: {
                            currentPrice: {
                                amount: 10
                                currencyCode: "USD"
                            }
                        }
                    }
                    quantity: {
                        amount: 1
                    }
                    lineItemAliases: [
                        {
                            aliasType: "ID"
                            aliasId: "e2a20tn5wnzf95"
                        }
                        {
                            aliasType: "EXTERNAL_ITEM_ID"
                            aliasId: "external-line-item-id-e2a20tn5wnzf95"
                        }
                        {
                            aliasType: "SKU"
                            aliasId: "sku-id-e2a20tn5wnzf95"
                        }
                    ]
                    clientDetails: {
                        browserFingerprint: {
                            browserPlatform: "Desktop"
                            browserType: "Chrome"
                            browserVersion: "105.0.0.0"
                            browserTimezone: "America/Los_Angeles"
                        }
                        ipFingerprint: {
                            ipAddress: "128.0.0.1"
                        }
                        storeFingerprint: {
                            storeUrl: "www.amazon.com"
                        }
                    }
                    selectedDeliveryOffer: {
                        details: {
                            id: "5060887210",
                            deliveryPreviewId: "SIP-8676502-0261200"
                            deliveryProvider: BUY_WITH_PRIME
                        }
                    }
                }
            ]
            customer: {
                id: "customer-id-1"
                contact: {
                    emailData: {
                        name: "John Smith"
                        email: "[email protected]"
                    }
                }
            }
            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: "[email protected]"
                                }
                            }
                        }
                    }
                ]
            }
            orderTotal: {
                totalPrice: {
                    amount: 10
                    currencyCode: "USD"
                }
            }
            desiredExecutionState: STARTED
        }
    ) {
        id
    }
}

Response

{
  "data": {
    "updateOrder": {
      "id": "123-4567-8910"
    }
  }
}

Initiate Fulfillment With Order Id

Request

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

Response

{
  "data": {
    "updateOrder": {
      "id": "123-4567-8910"
    }
  }
}