Update a Buy with Prime Order
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.
This topic provides examples of how to update information in a Buy with Prime order.
You must successfully create an order before you can update it. To learn how to create an order, see Create a Buy with Prime Order.
To learn how to call the Buy with Prime API, see Call the Buy with Prime API.
Note: We currently donβt support deleting or updating the orderAlias
, orderLink
, or discount
fields of an order. If you pass null to these fields in a call to updateOrder
, expect that the existing values of these fields won't change.
Trigger fulfillment for an existing order
This example shows how to trigger fulfillment for an order that you created with desiredExecutionState
set to NOT_STARTED
. To trigger fulfillment, you set desiredExecutionState
to STARTED
by using the updateOrder
mutation.
Request
// GraphQL mutation
mutation updateOrder($orderIdentifier: OrderIdentifierInput!, $input: UpdateOrderInput!) {
updateOrder(orderIdentifier: $orderIdentifier, input: $input) {
order {
id
}
}
}
// Mutation variables
{
"orderIdentifier": {
"orderId": "example-order-id",
},
"input": {
"desiredExecutionState": "STARTED"
}
}
Response
{
"data": {
"updateOrder": {
"order": {
"id": "example-order-id"
}
}
}
}
Update order-level attributes
You can update order-level attributes by using the updateOrder
mutation. This example shows how to update order-level attributes such as the total price and taxes on the order.
Request
// GraphQL mutation
mutation updateOrder($orderIdentifier: OrderIdentifierInput!, $input: UpdateOrderInput!) {
updateOrder(orderIdentifier: $orderIdentifier, input: $input) {
order {
id
totalPrice {
value {
amount
currencyCode
}
}
taxes {
summary {
collectableTaxAmount {
amount
}
}
}
}
}
}
// Mutation variables
{
"orderIdentifier": {
"orderId": "example-order-id",
},
"input": {
"totalPrice": {
"value": {
"amount": 20,
"currencyCode": "USD"
}
},
"taxes": {
"summary": {
"collectableTaxAmount": {
"amount": 12,
"currencyCode": "USD"
}
}
}
}
}
Response
{
"data": {
"updateOrder": {
"order": {
"id": "example-order-id",
"totalPrice": {
"value": {
"amount": 20,
"currencyCode": "USD"
}
},
"taxes": {
"summary": {
"collectableTaxAmount": {
"amount": 12
}
}
}
}
}
}
}
Update refund details for an order
For examples, see Update Refund Details.
Related topics
Updated about 20 hours ago