Update Refund Details

📘

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.

As you process Buy with Prime refunds, you must update the associated Buy with Prime order with the latest information. For a given refund, you typically call the Buy with Prime updateOrder mutation multiple times. For details, see Steps to Process Refunds.

The following table shows the refund state values that you can set on your next call to updateOrder given the current refund state. For details about processing refunds, see Steps to Process Refunds.

Current refund stateAllowable states you can use when you update a Buy with Prime refund
PENDINGPENDING, PARTIAL, FAILURE, SUCCESS
FAILUREPARTIAL, FAILURE, SUCCESS
PARTIALPARTIAL, SUCCESS
SUCCESSSUCCESS

When you provide refund details to updateOrder, use the id from the refunds.details field you received in a REFUND_REQUESTED event or from the order query. For a single call to updateOrder, the refund ID must be unique for each element in the refunds.details list.

The following examples show how to update the refund details of an order.

Update refund details and set the refund state to PARTIAL

After you initiate a refund payment in your order management system, you must update the Buy with Prime order with the amount that was refunded to the customer. The following example request indicates that $4 of a requested $10 refund has been initiated. For details, see Steps to Process Refunds.

Request
// GraphQL mutation
mutation updateOrder {
  updateOrder(
    input: {
       orderId: "example-order-id"
       refunds: {
         details: [
           {
             id: "refund-123"
             aliases: [
               {
                 aliasType: "EXTERNAL_REFUND_ID"
                 aliasId: "your-oms-refund-id"
               }
             ]
             refundTotal: { totalAmount: { amount: 4, currencyCode: "USD" } }
             state: PARTIAL
             refundFor: {
               orderLineItems: [
                   { lineItemId: { lineItemId: "example-line-item-id" } }
               ]
             }
             paymentDetails: [
                 {
                   id: "example-payment-transfer-id-1"
                   amount: { amount: 4, currencyCode: "USD" }
                   paymentMethod: {
                     displayString: "Visa ending in 1234"
                     type: AMAZON_PAY
                   }
                   state: SUCCESS
                   ... Payment details ...
                 }
             ]
           }
         ]
       }
    }
  ) {
   id
  }
}
Response
{
  "data": {
    "updateOrder": {
      "id": "example-order-id"
    }
  }
}

Update refund details and set the refund state to SUCCESS

The following sample request updates a refund that was previously $4 with another $6. The request sets the refund state to SUCCESS because the total refund amount ($10) is complete.

Request
// GraphQL mutation
mutation updateOrder {
  updateOrder(
    input: {
        orderId: "example-order-id"
        refunds: {
          details: [
            {
              id: "refund-123"
              aliases: [
                 {
                   aliasType: "EXTERNAL_REFUND_ID"
                   aliasId: "your-oms-refund-id"
                 }
              ]
              refundTotal: { totalAmount: { amount: 10, currencyCode: "USD" } }
              state: SUCCESS
              refundFor: {
                orderLineItems: [
                { lineItemId: { lineItemId: "product-123" } }
                ]
              }
              paymentDetails: [
                {
                  id: "payment-transfer-id-2"
                  amount: { amount: 6, currencyCode: "USD" }
                  paymentMethod: {
                    displayString: "Visa ending in 1234"
                    type: AMAZON_PAY
                  }
                  state: SUCCESS
                  ...Payment details...
                }
              ]
            }
           ]
            }
        }
      ) {
       id
    }
}
Response
{
  "data": {
    "updateOrder": {
      "id": "example-order-id"
    }
  }
}

Related topics