Use the cancellation and refund API to initiate cancellations or refunds on a given order.
You can only cancel an order or items (unshipped) fully or partially.
Orders can be canceled after they are moved out of the FB_PROCESSING state, with an exception of orders in the FB_PROCESSING state for more than 24 hours. An order can be in the FB_PROCESSING state for that long due to: 1) the inability to complete the buyer risk check or 2) a sanction on the buyer's account.
curl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v24.0/<ORDER_ID>/cancellations
| Attribute | Description |
|---|---|
Type: | Optional Why the seller is canceling the order; for example, out of stock. |
Type: boolean | Optional By default, the value is |
Type: array of | Optional Array of items being canceled. |
Type: string | Required Unique key per request. |
cancel_reason object| Attribute | Description |
|---|---|
Type: | Optional Reason for the cancellation. |
Type: string | Optional Reason for the cancellation, this message may be presented to the user. |
items| Attribute | Description |
|---|---|
Type: string | Required if ID representing the product in the seller's catalog. You must provide |
Type: string | Required if A Meta-generated ID representing the line item on the order. This value is readable as the |
Type: number | Required Number of items canceled. |
reason_code enum| Value | Description |
|---|---|
| Cancellation requested by the buyer. |
| Product is out of stock at fulfillment. |
| Unable to ship to address provided by the buyer. |
| Order is suspicious/possible fraud. |
| Other cancellation reason. |
{
"cancel_reason": {
"reason_code": "CUSTOMER_REQUESTED",
"reason_description": "Buyer did not need it anymore"
},
"restock_items": true,
"idempotency_key": "cb090e84-e75a-9a34-45d3-5153bec88b65"
}{
"cancel_reason": {
"reason_code": "OUT_OF_STOCK",
"reason_description": "Ran out of item"
},
"restock_items": false,
"items": [
{
"retailer_id": "FB_product_1234",
"quantity": 1
}
],
"idempotency_key": "cb090e84-e75a-9a34-45d3-5153bec88b65"
}If successful:
{
"success": true
}Otherwise, a relevant error message is returned.
You can only refund an order or items (shipped), fully or partially (by quantity or price).
curl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v24.0/<ORDER_ID>/refunds
| Attribute | Description |
|---|---|
Type: array of | Optional For partial refund, specify the item-level breakdown. Not required for a full refund. |
Type: | Required Reason for the refund. |
Type: string | Optional Reason for the refund. This message is presented to the user. |
Type: string | Required Unique key per request. |
Type: | Optional Amount to be refunded for shipping. |
Type: array of | Optional Amount to be deducted off of the refund. Commonly used for a return label fee for order returns. |
Type: string | Optional ID representing the return to which the refund is associated. See Returns API |
deductions object| Attribute | Description |
|---|---|
Type: string | Required Currently |
Type: | Required Amount to be deducted for shipping. See |
shipping_refund object| Attribute | Description |
|---|---|
Type: | Required Amount to be refunded for shipping. See |
refund_item object| Attribute | Description |
|---|---|
Type: string | Required if ID representing the product in the seller's catalog. You must provide |
Type: string | Required if A Meta-generated ID representing the line item on the order. This value is readable as the |
Type: | Required if Amount to refund, before any tax. Can be any value up to the full value of the item. See |
Type: number | Required if Number of items to be refunded fully. |
currency_amount object| Attribute | Description |
|---|---|
Type: string | Required Amount in decimal format. Example: |
Type: string | Required Three digit ISO-4217-3 code for the purchase. Format the currency as a number, followed by the 3-digit ISO currency code (ISO 4217 standards), with a space between cost and currency. Example: |
refund_reason_code enum| Value | Description |
|---|---|
| Refunded by buyers remorse. |
| Refunded as goods were delivered damaged. |
| Product not as described. |
| Product had quality issues. |
| Other refund reason. |
| Wrong product delivered. |
| Refund issued by the Facebook support team, usually in response of a dispute with the buyer. |
{
"reason_code": "WRONG_ITEM",
"idempotency_key": "cb090e84-e75a-9a34-45d3-5153bec88b65"
}{
"items": [
{
"retailer_id": "1234",
"item_refund_quantity": 1
},
{
"retailer_id": "38383838",
"item_refund_amount": {
"amount": "2.5",
"currency": "USD"
}
}
],
"shipping": {
"shipping_refund": {
"amount": "2.4",
"currency": "USD"
}
},
"deductions": [
{
"deduction_type": "RETURN_SHIPPING",
"deduction_amount": {
"amount": "5.5",
"currency": "USD"
}
}
],
"reason_code": "WRONG_ITEM",
"idempotency_key": "cb090e84-e75a-9a34-45d3-5153bec88b65"
}If successful:
{
"success": true
}Otherwise, a relevant error message is returned.
If you received an error that this order couldn't be refunded until the customer's payment method had been charged, validate if the payment was captured.
curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v24.0/<ORDER_ID>/cancellations
If successful:
{
"data": [
{
"id": "412737486183265",
"items": {
"data": [
{
"id": "32121321312",
"product_id": "2082596341811586",
"retailer_id": "FB_product_1234",
"quantity": 1
}
]
},
"cancel_reason": {
"reason_code": "CUSTOMER_REQUESTED",
"reason_description": "Buyer did not need it anymore"
}
}
]
}
curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v24.0/<ORDER_ID>/refunds
| Attribute and Type |
|---|
Type: array of |
refund_item_object| Attribute | Description | Default Display |
|---|---|---|
Type: string | Refund unique ID. | Yes |
Type: | Array of refunded items. | Yes |
Type: | Total refund amount. See | Yes |
Type: number | Reason for the refund. See | Yes |
items object| Attribute and Type |
|---|
Type: array of |
item object| Attribute | Description |
|---|---|
Type: string | Unique ID for order item. |
Type: string | Unique product ID. |
Type: string | Unique product ID set by seller. |
Type: object | Subtotal of refund. |
Type: number | Optional Item refund quantity, only present when refunding an order with |
refund_subtotal object| Attribute | Description | Default Display |
|---|---|---|
Type: string | Amount in decimal format. Example: | Yes |
Type: string | Three digit ISO-4217-3 code for the purchase. Format the currency as a number, followed by the 3-digit ISO currency code (ISO 4217 standards), with a space between cost and currency. Example: | Yes |
refund_amount object| Attribute | Description | Default Display |
|---|---|---|
Type: string | Amount in decimal format. Example: | Yes |
Type: string | Three digit ISO-4217-3 code for the purchase. Format the currency as a number, followed by the 3-digit ISO currency code (ISO 4217 standards), with a space between cost and currency. Example: | Yes |
Type: string | Amount in decimal format with negative sign. Example: | No |
Type: string | Amount in decimal format with negative sign. Example: | No |
Type: string | Amount in decimal format. Example: | No |
Type: string | Amount in decimal format. Example: | No |
curl GET \
-d 'fields=id,items{product_id,retailer_id,refund_subtotal,quantity},refund_reason,refund_amount{subtotal,tax,total,amount,currency}' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v24.0/<ORDER_ID>/refunds
If successful:
{
"data": [
{
"id": "498980194169539",
"items": {
"data": [
{
"id": "486602442073981",
"product_id": "2452389501475182",
"retailer_id": "FB_shirt_1234",
"refund_subtotal": {
"amount": "1.00",
"currency": "USD"
},
"quantity": 1
}
]
},
"refund_reason": {
"reason_code": "BUYERS_REMORSE"
},
"refund_amount": {
"subtotal": "1.00",
"shipping": "10.00",
"tax": "-1.02",
"total": "12.02",
"amount": "12.02",
"currency": "USD"
},
}
],
"paging": {
"cursors": {
"before": "QVFIUkdCNjRRQ2tpZAloxbFlZAMnZABN3pYcnB5TzZALYlAzTVo2eF8wM3BraFRRRWNLZAnJwczAtanA0VUE4WnB4dVZAQYUE3OTRZASTBMZAjBWYWxOZAGJJdm9vODRn",
"after": "QVFIUkdCNjRRQ2tpZAloxbFlZAMnZABN3pYcnB5TzZALYlAzTVo2eF8wM3BraFRRRWNLZAnJwczAtanA0VUE4WnB4dVZAQYUE3OTRZASTBMZAjBWYWxOZAGJJdm9vODRn"
}
}
}