updateOrder

Version 2024-04-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: "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
                    aliases {
                        aliasType
                        aliasId
                    }
                    refundTotal {
                        totalAmount {
                            amount
                            currencyCode
                        }
                    }
                }
            }
        }
    }
}

Response

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

Initiate Fulfillment With Order Id

Request

mutation updateOrder{
    updateOrder(
        input: {
            orderId: "322-ABC1-AAAAAA"
            desiredExecutionState: STARTED
        }
    ) {
        order {
            id
        }
    }
}

Response

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