Shopify returns
Shopify returns
With EcartAPI you can run the whole Shopify returns cycle:
- Know what can be returned.
- Create the return as the seller or on behalf of the buyer.
- Approve or decline buyer requests.
- Send the items back with tracking and a label.
- Restock, fulfill exchanges and refund.
- Close or reopen the return.
This guide explains each piece and the Shopify behaviors you will run into. The API Reference has every request and response.
Before you start
- Shopify requires the
read_returnsscope to read returns andwrite_returnsto create or change them. Your app must request them and the store must authorize them; a store connected before you added them has to authorize the app again.- Every amount, quantity and boolean is sent and received as a string (
"1","25.99","true").- Ids are numeric strings. Shopify global ids (
gid://shopify/Return/123) are also accepted.
Concepts
| Concept | What it is | Where it appears |
|---|---|---|
| Return | The return of one or more items of an order, with its status, reasons and refunds. | return |
| Return item | An order item being returned, with its quantity and reason. | return.returnItems[] |
| Exchange item | A product the customer receives in place of the returned one. | return.exchangeItems[] |
| Return package | What has to travel back to the store. A return can have several packages. | return.returnPackages[] |
| Return fulfillment | One shipment of a package back to the store, with tracking and a label. A package can have several. | returnFulfillment |
| Refund | Money returned to the customer for the return. | return.refunds[] |
flowchart LR O[Order] --> R[Return] R --> RI[Return items] R --> EI[Exchange items] R --> RP[Return packages] RP --> RF[Return fulfillments] R --> RE[Refunds]
The return flow mirrors the order flow: order → package → fulfillment becomes return → return package → return fulfillment. returnFulfillmentOrderId in a return is the counterpart of fulfillmentOrderId in an order.
Endpoints
| Endpoint | What it does |
|---|---|
Get returnable items GET /orders/{orderId}/returns/returnable | Items of the order that can still be returned |
Get return reasons GET /returns/reasons | Reasons catalog of the store |
Create a return POST /orders/{orderId}/returns | Create a seller return or a buyer request |
Get all returns GET /orders/{orderId}/returns | Returns of an order |
Get a return GET /orders/{orderId}/returns/{returnId} | Full detail of a return |
Get a return by id GET /returns/{returnId} | Same detail when you do not have the order |
Approve POST …/returns/{returnId}/approve | Approve a buyer request |
Reject POST …/returns/{returnId}/reject | Decline a buyer request |
Cancel POST …/returns/{returnId}/cancel | Cancel before processing |
Process POST …/returns/{returnId}/process | Receive items, restock, fulfill exchanges and refund |
Close POST …/returns/{returnId}/close | Close a return |
Reopen POST …/returns/{returnId}/reopen | Reopen a closed return |
Get return fulfillments GET …/returns/{returnId}/fulfillments | Shipments of a return |
Get a return fulfillment GET …/fulfillments/{returnFulfillmentId} | One shipment |
Create a return fulfillment POST …/returns/{returnId}/fulfillments | Add tracking and label for a package |
Update a return fulfillment PUT …/fulfillments/{returnFulfillmentId} | Fix tracking or label |
… stands for /orders/{orderId}. The order endpoint also lists the return packages of an order with GET /orders/{orderId}?include=returnPackages.
Statuses
status is an object, the same shape used in orders:
"status": { "id": null, "status": "OPEN", "ecartapi": "open", "ecartapiId": "2", "substatus": null }status: the raw Shopify value.ecartapi/ecartapiId: the EcartAPI standard. Use it to build logic that also works with other platforms.idandsubstatusare alwaysnullon Shopify.
Shopify status | ecartapi | ecartapiId | Meaning |
|---|---|---|---|
REQUESTED | requested | 1 | The buyer asked for the return; waiting for the seller |
OPEN | open | 2 | Approved or created by the seller; items on their way or being handled |
DECLINED | declined | 3 | The request was declined |
CANCELED | canceled | 4 | Canceled before processing |
CLOSED | closed | 5 | Finished |
| — | other | 6 | A status without a mapping |
stateDiagram-v2 [*] --> REQUESTED: create (buyer) [*] --> OPEN: create (seller) REQUESTED --> OPEN: approve REQUESTED --> DECLINED: reject OPEN --> CANCELED: cancel (before processing) OPEN --> CLOSED: process all items (asynchronous) or close CLOSED --> OPEN: reopen
Return package status. Shopify leaves a package OPEN even after its items are processed, and there is no way to close it. So in returnPackages[].status:
statuskeeps the raw Shopify value.ecartapiis computed:closedwhen every item of the package was processed, or when the return is closed.canceledwhen the return was canceled.openotherwise.
Use ecartapi to know whether a package is done.
The return object
{
"id": "39195148457",
"name": "#1721-R2",
"orderId": "18997674868905",
"status": { "id": null, "status": "CLOSED", "ecartapi": "closed", "ecartapiId": "5", "substatus": null },
"requestedBy": "seller",
"totalQuantity": "1",
"decline": { "isDeclined": "false", "reason": null, "note": null },
"returnItems": [
{
"id": "53728247977",
"orderItemId": "50925749567657",
"fulfillmentItemId": "18725256593577",
"productId": null,
"variantId": null,
"name": "Hacha Rhitta - Seven Deadly Sins",
"sku": "hacha-333",
"quantity": "1",
"processedQuantity": "1",
"reason": { "id": "9", "handle": "style", "name": "Style" },
"reasonNote": "Exchange requested by the customer",
"customerNote": null
}
],
"exchangeItems": [
{ "id": "3793289385", "productId": "9008390570153", "variantId": "47306191896745", "name": "Descuentos - large / white", "sku": "34567", "quantity": "1", "processedQuantity": "1" }
],
"returnPackages": [
{
"id": "38720798889",
"returnFulfillmentOrderId": "38720798889",
"status": { "id": null, "status": "OPEN", "ecartapi": "closed", "ecartapiId": "5", "substatus": null },
"logisticMode": null,
"items": [
{ "id": "52528480425", "returnItemId": "53728247977", "orderItemId": "50925749567657", "name": "Hacha Rhitta - Seven Deadly Sins", "quantity": "1" }
]
}
],
"refunds": [
{ "id": "1036219138217", "amount": "0.00", "currency": "MXN", "note": null, "createdAt": "2026-11-19T23:55:28Z" },
{ "id": "1036221137065", "amount": "39.44", "currency": "MXN", "note": null, "createdAt": "2026-11-20T00:25:14Z" }
],
"dates": { "createdAt": "2026-11-19T23:51:23Z", "approvedAt": "2026-11-19T23:51:23Z", "closedAt": "2026-11-19T23:55:30Z", "updatedAt": null }
}| Property | Meaning |
|---|---|
id | Return id. Use it as {returnId} in the routes. |
name | Name shown in Shopify (#1721-R2). |
orderId | Order the return belongs to. |
status | Status object (see Statuses). |
requestedBy | buyer or seller. On returns read from Shopify, it is seller when the return was approved at the moment it was created, and buyer when it was requested and approved later. |
totalQuantity | Total units in the return. |
decline | Always an object. isDeclined is "true" when the request was declined; reason (FINAL_SALE, OTHER, RETURN_PERIOD_ENDED) and note explain why. |
returnItems[].id | Return item id. You send it as items[].id when processing. |
returnItems[].orderItemId | The order item being returned (items[].id in the order). |
returnItems[].fulfillmentItemId | The item of the original shipment. |
returnItems[].productId / variantId | null on Shopify. Match orderItemId with the order items[].id to get them. |
returnItems[].quantity / processedQuantity | Units being returned / units already processed. |
returnItems[].reason | Always an object: { id, handle, name }. |
returnItems[].reasonNote / customerNote | Note from the seller / note from the buyer. |
exchangeItems[] | Products the customer receives. id is sent when processing; processedQuantity tells how many were already fulfilled. |
returnPackages[].id | Package id. Equal to returnFulfillmentOrderId. |
returnPackages[].returnFulfillmentOrderId | Send it when creating a return fulfillment for this package. |
returnPackages[].items[].id | Package item id. Send it as items[].id when creating a return fulfillment and as dispositions[].returnPackageItemId when processing. |
returnPackages[].items[].returnItemId | The return item this package item belongs to. |
refunds[] | Refunds linked to the return: id, amount, currency, note, createdAt. See Zero-amount refunds. |
dates | createdAt, approvedAt, closedAt, updatedAt. |
Objects are never null in returns: status, decline, dates, reason, package status, and the return fulfillment tracking and document are always objects whose keys can be null. Lists are always lists ([] when empty).
The return fulfillment object
{
"id": "9313190057",
"returnId": "39178993833",
"returnFulfillmentOrderId": "38704840873",
"orderId": "18996869333161",
"status": null,
"tracking": { "number": "223444000", "company": null, "url": "https://tracking.example.com/223444000" },
"document": { "url": "https://cdn.example.com/labels/223444000.pdf" },
"items": [
{ "id": "12757663913", "returnItemId": "53704687785", "returnPackageItemId": "52505215145", "orderItemId": "50923588878505", "productId": null, "variantId": null, "name": "Descuentos - large / white", "sku": null, "quantity": "1" }
]
}| Property | Meaning |
|---|---|
id | Return fulfillment id ({returnFulfillmentId}). |
returnId / returnFulfillmentOrderId / orderId | Return, package and order it belongs to. |
status | Always null on Shopify: Shopify gives no status to the shipment. Follow the return and its packages. |
tracking | { number, company, url }. |
document.url | Return label. |
items[].quantity | Units in this shipment. |
items[].returnItemId | Filled only by the list endpoint; null in the other responses. |
Where each id comes from
| You send | Take it from |
|---|---|
Create return → items[].id | Returnable → items[].fulfillmentItemId |
Create return → items[].reasonId | Return reasons → reasons[].id |
Create return → exchangeItems[].variantId | The product variant you will send |
Create return fulfillment → returnFulfillmentOrderId | returnPackages[].returnFulfillmentOrderId |
Create return fulfillment → items[].id | returnPackages[].items[].id |
Process → items[].id | returnItems[].id |
Process → dispositions[].returnPackageItemId | returnPackages[].items[].id of the same return item (its returnItemId equals items[].id) |
Process → dispositions[].locationId | Get all locations → id |
Process → exchangeItems[].id | exchangeItems[].id of the return |
Process → refund.transactions[].parentId | Get order transactions → a transaction of kind sale or capture |
Flows
A. The seller creates the return
-
Get the returnable items and pick the units.
-
Create the return with
requestedBy: seller. It isOPENright away.{ "return": { "requestedBy": "seller", "items": [{ "id": "18723222716585", "quantity": "1", "reasonId": "1", "reasonNote": "Too small" }] } } -
Create a return fulfillment with the tracking and label of the package. Your project generates the label (see Return labels).
{ "returnFulfillment": { "returnFulfillmentOrderId": "38704840873", "items": [{ "id": "52505215145", "quantity": "1" }], "tracking": { "number": "223444000", "url": "https://tracking.example.com/223444000" }, "documents": { "document": "https://cdn.example.com/labels/223444000.pdf" }, "notifyCustomer": "true" } } -
When the package arrives, process the return: restock and refund.
{ "returnProcess": { "items": [{ "id": "53704687785", "quantity": "1", "dispositions": [{ "returnPackageItemId": "52505215145", "quantity": "1", "type": "RESTOCKED", "locationId": "79469592745" }] }], "refund": { "transactions": [{ "parentId": "20944553705641", "amount": "25.99", "currency": "MXN" }] }, "notifyCustomer": "true" } } -
Shopify closes the return by itself when every item is processed. See Closing is asynchronous.
B. The buyer requests a return and you approve it
- The request reaches you in one of two ways:
-
Your portal creates it with
requestedBy: buyer. It isREQUESTED.{ "return": { "requestedBy": "buyer", "items": [{ "id": "18725256593577", "quantity": "1", "reasonId": "9", "customerNote": "I would like the large / white version" }] } } -
The buyer requests it from their Shopify account and the
returnswebhook delivers the full return.
-
- Approve it (optional body:
{ "return": { "notifyCustomer": "true" } }). It moves toOPEN. Get the return to read itsreturnPackages[]before creating a return fulfillment. - Continue with steps 3 to 5 of flow A.
C. The buyer requests a return and you decline it
Reject it with a reason. It moves to DECLINED and decline.isDeclined is "true".
{ "return": { "declineReason": "RETURN_PERIOD_ENDED", "declineNote": "The 30-day return window has ended.", "notifyCustomer": "true" } }D. The buyer wants an exchange
Shopify does not accept exchange items in a buyer request, and they cannot be added to a REQUESTED return. To give the buyer an exchange:
-
Decline the buyer request (flow C). The note can tell the buyer that a new return is coming.
-
Create a seller return for the same items with
exchangeItems. You can keep the buyer's note inreasonNote.{ "return": { "requestedBy": "seller", "items": [{ "id": "18725256593577", "quantity": "1", "reasonId": "9", "reasonNote": "Exchange requested by the customer" }], "exchangeItems": [{ "variantId": "47306191896745", "quantity": "1" }] } } -
Create the return fulfillment as in flow A.
-
Process the return item and the exchange item (
exchangeItems[].idcomes from the return). If your policy refunds part of the price, addrefund(see Refund amounts).{ "returnProcess": { "items": [{ "id": "53728247977", "quantity": "1", "dispositions": [{ "returnPackageItemId": "52528480425", "quantity": "1", "type": "RESTOCKED", "locationId": "79469592745" }] }], "exchangeItems": [{ "id": "3793289385", "quantity": "1" }] } }
E. Refund later
You can process the items first and refund afterwards:
-
Process with
itemsand norefund. Shopify records a zero-amount refund (see Zero-amount refunds). -
When you are ready, process again with only
refund. This works even if the return is alreadyCLOSED, and the refund stays linked to the return.{ "returnProcess": { "refund": { "transactions": [{ "parentId": "20945627578537", "amount": "39.44", "currency": "MXN" }] }, "notifyCustomer": "true" } }
F. Cancel, close or reopen
- Cancel an
OPENreturn before anything is processed. - Close a return that stays
OPENafter you finished with it. - Reopen a
CLOSEDreturn to process it again.
None of them take a body.
Webhooks
Subscribe to these resources to follow returns without polling (see Webhooks). Each delivery is the full object, the same one the API returns.
Register one webhook per resource and action:
POST /api/v2/webhooks
{
"resource": "returns",
"action": "create",
"url": "https://yourdomain.com/webhooks/returns/create"
}Repeat it for returns / update and returnFulfillments / create.
| Resource / action | Shopify event | Body |
|---|---|---|
returns / create | The buyer requested a return | The return |
returns / update | A return was approved, declined, canceled, processed, closed, reopened or changed | The return |
returnFulfillments / create | Tracking or a label was added to a return fulfillment | The return fulfillment |
Things to keep in mind
Closing is asynchronous
When the last item is processed, Shopify closes the return a moment later. The process response can still say OPEN with closedAt: null. To get the final status:
- read the return again, or
- wait for the
returns/updatewebhook.
Call close only if the return stays OPEN.
Zero-amount refunds
Processing without refund makes Shopify create a refund of 0.00. It records the restocked items. It also shows that the return was processed without money back, so it is listed in refunds[] on purpose.
Refund amounts
EcartAPI and Shopify refund exactly the amount you send in refund.transactions[].amount. Neither of them computes it: how much to refund (item price, discounts, taxes, shipping, exchanges, fees) is decided by your project and your return policy.
What Shopify requires:
parentIdis a transaction of kindsaleorcaptureof the order.amountis in the currency of that transaction, which is the currency the customer paid in.- The total refunded cannot exceed what was paid for the order, unless you send
allowOverRefunding: "true".
Data you can read from EcartAPI:
| Where | Fields |
|---|---|
| Order items (Get an order) | price: unit price before discounts. discount: discounts allocated to the whole line. salePrice: price minus discount divided by quantity. All three in the store currency; priceExtension and discountExtension are in the customer's currency. |
| Order | currency (store), currencyExtension (customer), taxesIncluded, taxLines[] |
| Order transactions | kind (sale, capture, refund…), amount, currency |
Order refunds[] | Refunds already issued on the order: amount and refundItems |
Return refunds[] | Refunds linked to this return |
- A
saletransaction keeps its original amount after a refund; each refund is listed as a separate transaction of kindrefund. - Item-level taxes are not available for Shopify orders (
items[].taxisnull). - EcartAPI cannot charge the customer. If an exchange item costs more than the returned one, collect the difference through your own channel.
Return labels
EcartAPI does not generate return labels. Your project creates the label and sends its tracking and URL when creating the return fulfillment. For the origin and destination of the label, we suggest using the order's shipping address (Get an order) and the store locations (Get all locations).
Check that dispositions match
Shopify accepts a returnPackageItemId from another return or another item without an error, and then the restock is not applied where you expect. For each item you process:
- Find its package item in
returnPackages[].items[], wherereturnItemIdequals the return itemid. - Use that package item's
idasreturnPackageItemId.
Several packages
A return can have more than one package. In that case:
- Send
returnFulfillmentOrderIdwhen you create a return fulfillment; without it the request is rejected. With a single package it is optional. - Each package reports its own status.
What the lists include
- The returns list of an order includes up to 10 returns, without pagination or filters. Each return shows fewer items and refunds than the detail. Get a return by id for the full data.
- Only the return fulfillments list fills
items[].returnItemId.
Product and variant ids
returnItems[].productId and variantId are null on Shopify. Match orderItemId with the order items to get them.
Reasons and notes
- Get the reasons with the reasons endpoint instead of hard-coding them; any reason applies to any product.
- If you send a
reasonhandle that does not exist, it is saved as a note. reasonNote(seller, max 255) is used in seller returns;customerNote(buyer, max 300) in buyer requests.
Implementation checklist
- The store grants
read_returnsandwrite_returns. - Webhooks registered for
returns(create,update) andreturnFulfillments(create). - Return reasons loaded from the reasons endpoint, not hard-coded.
- Refund amounts decided by your project and your return policy.
- Return labels generated by your project.
- Location ids for restocking taken from the locations endpoint.
- Each disposition uses the package item of the same return item.
- The final status is read after processing (asynchronous close).
- Full flow tested in a Shopify development store.
Errors
| Case | Response |
|---|---|
| The body does not match the schema | 422 with the validation detail |
| An id with an invalid format | 400 |
| The return belongs to another order, or the return or return fulfillment does not exist | 404 |
Creating a return fulfillment without returnFulfillmentOrderId when the return has zero or several packages | 400 |
Shopify rejects the operation (for example, approving a return that is not REQUESTED) | 400 with the Shopify detail |
Errors use the standard shape:
{ "statusCode": 422, "error": "Unprocessable Entity", "message": "\"returnProcess\" must contain at least one of [items, exchangeItems, refund, refundShipping]", "ecartapiError": true }Updated 4 days ago