Get 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 for an order, you can get details about all the refunds associated with the order. You then initiate the refunds and update the Buy with Prime order with the latest information. For details, see Steps to Process Refunds.
The following examples show how to get information about Buy with Prime refunds.
For an overview of refund terminology, see Synchronize Refunds. To learn how to call the Buy with Prime API, see Call the Buy with Prime API.
Get refund details for an order
After you receive a REFUND_REQUESTED
event, you parse the resources
array of the event to get the order ID, and then you query the associated order to get information about any refunds that are associated with the order.
The following example query gets the line item, product, and refund data for an order. The response shows that the refund is in PENDING
state. The refund is associated with line item example-line-item-id
. The estimated amount to be refunded is $10.
Request
// GraphQL query
query order {
order(orderIdentifier: { orderId: "example-order-id" }) {
id
refunds {
details {
id
state
aliases {
aliasType
aliasId
}
createdAt
updatedAt
refundTotal {
totalAmount {
currencyCode
amount
}
}
refundFor {
orderLineItems {
lineItem {
id
}
amount {
unit
value
}
}
}
paymentDetails {
id
amount {
currencyCode
amount
}
paymentMethod {
displayString
type
}
state
}
}
}
}
}
Response
{
"data": {
"order": {
"id": "example-order-id",
"refunds": {
"details": [
{
"id": "example-refund-id",
"state": "PENDING",
"aliases": [],
"createdAt": "2024-04-03T14:14:18.160Z",
"updatedAt": "2024-04-03T14:14:18.410Z",
"refundTotal": {
"totalAmount": {
"currencyCode": "USD",
"amount": 10.00
}
},
"refundFor": {
"orderLineItems": [
{
"lineItem": {
"id": "example-line-item-id"
},
"amount": {
"unit": "ONE",
"value": 1
}
}
]
},
"paymentDetails": []
}
]
}
}
}
}
Get the refund request reason and the refund status reason
For additional context about a refund, you can query an order to find the refund request reason and refund status reason of the refunds associated with the order. These fields are in the refunds.details
object of the response.
Request
// GraphQL query
query order {
order(orderIdentifier: { orderId: "example-order-id" }) {
id
refunds {
details {
id
state
aliases {
aliasType
aliasId
}
createdAt
updatedAt
refundTotal {
totalAmount {
currencyCode
amount
}
}
refundFor {
orderLineItems {
lineItem {
id
}
amount {
unit
value
}
}
}
paymentDetails {
id
amount {
currencyCode
amount
}
paymentMethod {
displayString
type
}
state
}
refundRequestReason
refundStatusReason
}
}
}
}
Response
{
"data": {
"order": {
"id": "example-order-id",
"refunds": {
"details": [
{
"id": "example-refund-id",
"state": "REJECTED",
"aliases": [],
"createdAt": "2024-04-03T14:14:18.160Z",
"updatedAt": "2024-04-03T14:14:18.410Z",
"refundTotal": {
"totalAmount": {
"currencyCode": "USD",
"amount": 10.00
}
},
"refundFor": {
"orderLineItems": [
{
"lineItem": {
"id": "example-line-item-id"
},
"amount": {
"unit": "ONE",
"value": 1
}
}
]
},
"paymentDetails": [],
"refundRequestReason": "CUSTOMER_NOT_SATISFIED_WITH_SERVICE",
"refundStatusReason": "FRAUDULENT_RETURN_ATTEMPT"
}
]
}
}
}
}
Related topics
Updated 2 days ago