Returns
Goods of an order the customer sends back: only units sent, each once at a time. The shop records a return, takes its units in as they arrive — back to the stock — gives money back for them with a refund naming it, and the return closes once every unit is received and refunded.
List returns
Lists the order's returns of goods, the oldest first, declined and cancelled ones too — all of them in one page by default: an order holds at most 50. Neither filters nor sorts.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: create_time desc. Sortable: none — this collection serves its documented order only.
filterAIP-160 subset (§8). Filterable: none. A field outside the list is INVALID_ARGUMENT.
List returns › Responses
One page of returns.
This page of returns, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create return
Records goods the customer sends back: {"lines": [{"line_id": "Xk9_a2Lm", "quantity": 1}], "reason": "Too small."}, each line once — units sent, at most the line's fulfilled_quantity less the units its other open, asked-for or closed returns hold. The return is OPEN at once, its lines with nothing received yet, and the order's return_status becomes RETURN_IN_PROGRESS; an order with a return open is not COMPLETED. Nothing else of the order changes, nor the stock: :receive takes the units in as they arrive, and a refund with return_id gives money back for them. FAILED_PRECONDITION answers, nothing recorded: RETURN_QUANTITY for lines asked more units than may come back — units not sent, or held by another return — or that the order has not, one violation each with its line_id and the units returnable; LIMIT for a 51st return — declined and cancelled ones count — or one that would take the order's returns past 20000 lines. lines missing or empty is INVALID_ARGUMENT. {"request_id": "…"} makes the call safe to repeat: a repeat answers the return it recorded. Two at once never take back more than was sent: the one that comes second is checked against what the first left, or answers ABORTED. Answers 201 and the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
Create return › Request Body
linesWhat comes back, line by line: [{line_id, quantity, received_quantity, restocked_quantity, refunded_quantity}]. line_id is the id of a line of the order, each line once; quantity the units that come back — units sent, at most the line's fulfilled_quantity less the units its other returns hold. On Create {line_id, quantity} alone; the server counts the rest: received_quantity the units :receive took in, restocked_quantity those of them put back on the stock, refunded_quantity the units refunds naming the return gave money back for — each 0 at first and at most quantity. Set on Create alone.
reasonWhy the goods come back, when the shop or the customer says: up to 500 characters, on one line or several.
request_idAn idempotency key you choose, at most 64 characters. Creating with a key the order already has a return of answers that return and records nothing again.
Create return › Responses
The created resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
statusWhere the return is: REQUESTED — the customer asked for it and the shop has not answered; OPEN — recorded by the shop, or the customer's approved: its goods come back and are received; CLOSED — done, by :close or once every unit of it is received and given money back; DECLINED — the shop said no; CANCELLED — taken back before anything of it was received. CLOSED, DECLINED and CANCELLED move no more.
linesWhat comes back, line by line: [{line_id, quantity, received_quantity, restocked_quantity, refunded_quantity}]. line_id is the id of a line of the order, each line once; quantity the units that come back — units sent, at most the line's fulfilled_quantity less the units its other returns hold. On Create {line_id, quantity} alone; the server counts the rest: received_quantity the units :receive took in, restocked_quantity those of them put back on the stock, refunded_quantity the units refunds naming the return gave money back for — each 0 at first and at most quantity. Set on Create alone.
reasonWhy the goods come back, when the shop or the customer says: up to 500 characters, on one line or several.
decline_reasonWhy the shop declined the customer's request, when :decline was given a reason; absent otherwise.
close_timeWhen the return was closed — by :close, or once every unit of it was received and given money back; absent on one not CLOSED.
actorWho recorded the return: {type, id?} — type USER and id the user of the account who created it; CUSTOMER for a request of the customer's.
Get return
A return of goods of an order: units the shop sent that come back to it. The shop records it — or approves the customer's request — receives its units as they arrive, puts them back on the stock, gives money back for them with a refund naming it, and it closes once every unit is received and given money back. Only units sent come back, and a unit only once at a time. The order's return_status follows its returns. A return is never deleted: a mistaken one is cancelled. An order holds at most 50, of 20000 lines in all; listed the oldest first.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get return › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
statusWhere the return is: REQUESTED — the customer asked for it and the shop has not answered; OPEN — recorded by the shop, or the customer's approved: its goods come back and are received; CLOSED — done, by :close or once every unit of it is received and given money back; DECLINED — the shop said no; CANCELLED — taken back before anything of it was received. CLOSED, DECLINED and CANCELLED move no more.
linesWhat comes back, line by line: [{line_id, quantity, received_quantity, restocked_quantity, refunded_quantity}]. line_id is the id of a line of the order, each line once; quantity the units that come back — units sent, at most the line's fulfilled_quantity less the units its other returns hold. On Create {line_id, quantity} alone; the server counts the rest: received_quantity the units :receive took in, restocked_quantity those of them put back on the stock, refunded_quantity the units refunds naming the return gave money back for — each 0 at first and at most quantity. Set on Create alone.
reasonWhy the goods come back, when the shop or the customer says: up to 500 characters, on one line or several.
decline_reasonWhy the shop declined the customer's request, when :decline was given a reason; absent otherwise.
close_timeWhen the return was closed — by :close, or once every unit of it was received and given money back; absent on one not CLOSED.
actorWho recorded the return: {type, id?} — type USER and id the user of the account who created it; CUSTOMER for a request of the customer's.
Approve (return)
Accepts the customer's request for a return: REQUESTED becomes OPEN, and its goods may come back — :receive takes them in. The customer is sent the return_approved email, in the language of the view the order was placed on. Takes no body. A return in any other state answers FAILED_PRECONDITION RETURN_STATUS with its status. Answers the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Approve (return) › Request Body optional
Approve (return) › Responses
The affected resource, or the method’s own response object (§10).
Cancel (return)
Takes a return back that was recorded by mistake, or that the customer gave up: REQUESTED or OPEN becomes CANCELLED, and its units may come back in another return. Takes no body. A return of which units were received already — close it instead — or one CLOSED, DECLINED or CANCELLED answers FAILED_PRECONDITION RETURN_STATUS with its status. Answers the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Cancel (return) › Request Body optional
Cancel (return) › Responses
The affected resource, or the method’s own response object (§10).
Close (return)
Closes an open return before every unit of it came back and was given money back: OPEN becomes CLOSED, with close_time. The units it did not receive may come back in another return. Takes no body. A return in any other state answers FAILED_PRECONDITION RETURN_STATUS with its status. Answers the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Close (return) › Request Body optional
Close (return) › Responses
The affected resource, or the method’s own response object (§10).
Decline (return)
Refuses the customer's request for a return: REQUESTED becomes DECLINED, and its units may be asked for again. {"reason": "…"}, optional, up to 500 characters, is kept as its decline_reason, and the customer is sent the return_declined email with it. A return in any other state answers FAILED_PRECONDITION RETURN_STATUS with its status. Answers the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Decline (return) › Request Body optional
Decline (return) › Responses
The affected resource, or the method’s own response object (§10).
Receive (return)
Records goods of an open return as arrived: {"lines": [{"line_id": "Xk9_a2Lm", "quantity": 1}], "restock": true}, each a line of the return once and at most what is left of it to receive. The return's lines count them in received_quantity, and the order's lines in returned_quantity. With restock — true unless the body says false, for goods damaged — the units go back to the stock of their variants still tracked, in the same transaction as the return's write, so exactly once, and the return counts them in restocked_quantity. A return whose every unit is received and given money back becomes CLOSED. FAILED_PRECONDITION answers, nothing recorded: RETURN_STATUS for a return not OPEN, with its status; RETURN_QUANTITY for lines asked more than is left of them to receive, or that the return has not, one violation each with its line_id and the units returnable. Answers the return.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
return_idId of the parent return.
Receive (return) › Request Body optional
Receive (return) › Responses
The affected resource, or the method’s own response object (§10).