Refunds
Money of an order given back to the customer: for units not sent, which it takes off the order and back to the stock, for the units of a return, or as money off a line's price. Worked out line by line to the minor unit of the currency — ask with validate_only first — and marked paid once the money went.
List refunds
Lists the order's refunds, the oldest first — all of them in one page by default: an order holds at most 100. 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 refunds › Responses
One page of refunds.
This page of refunds, 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 refund
Gives money of the order back to the customer. lines names what for, each line once: {"line_id": "Xk9_a2Lm", "quantity": 1} takes one unit not sent off the order — its cancelled_quantity grows, and the unit goes back to the stock unless the body says "restock": false — and gives back that unit's share of the line's total and tax, rounded to the currency's minor unit, the line's last unit taking what is left so the units of a line always come to its total. "amount" beside it gives back less; {"quantity": 0, "amount": {…}} is money off the line's price without units. With "return_id" the units are those of a return of goods of the order (…/returns), sent and not given money back yet: nothing is taken off the order nor put back on the stock — the return's :receive does that — the return's lines count them in refunded_quantity, and a return whose every unit is received and given money back becomes CLOSED; a return still REQUESTED, DECLINED or CANCELLED answers FAILED_PRECONDITION RETURN_STATUS. "shipping_amount": {…} gives back part of the order's shipping_total too — or alone, without lines — at most what is left of it past shipping.refunded_amount, which grows by it, with the same share of the shipping's tax (shipping_tax_amount); a return's refund gives back no shipping but what is sent here. The order's current_total goes down by the refund's total, and the line's refunded_amount grows by its amount; a refund that takes off the last units of an order nothing of which was sent cancels it, and gives back all that is left of the shipping with them, so nothing of the order is current. What of it the customer paid is owed back (payout_amount), and payout says how it goes back: DEFERRED — the default — later: the refund is PENDING and the order's outstanding_total below zero by it until :mark_paid or :pay; RECORDED — the money went back already, past the platform: the order's transactions take a REFUND of it, the refund is SUCCEEDED and the order PARTIALLY_REFUNDED or REFUNDED; PROVIDER — through the payment provider now: the money is laid over the order's payments at providers, the newest first, and each gets a REFUND of its own, sent to its provider at once — SUCCEEDED when the provider gives it back, PENDING while it is still working on it, FAILED with its failure_reason when it refuses. The refund becomes SUCCEEDED, with pay_time, once all its REFUNDs succeed; after a refusal it stays PENDING — the money is still owed — and :pay sends it again. A payout past what the payment providers can still give back (provider_refundable_total) answers FAILED_PRECONDITION REFUND_PROVIDER_AMOUNT with that amount, and nothing is recorded; an order paid offline can give back nothing so. On an order nothing of which was paid the refund is SUCCEEDED at once and only lowers what the order costs. The customer is sent the order_refunded email — the lines, the shipping, the tax and the total it gives back, and the reason — in the language of the view the order was placed on, unless the body says "notify_customer": false; a refund that gives no money back sends none. ?validate_only=true answers 200 and the refund it would record — its lines, tax_lines, total and payout_amount, without name, id or times — and records nothing. FAILED_PRECONDITION answers, nothing recorded: REFUND_AMOUNT for lines asked more units than are left of them — or than the return named holds — or more money than is left of their total, REFUND_REQUIRES_RETURN for units already sent without return_id, one violation each with its line_id, refundable_quantity and refundable_amount; ORDER_STATUS for a cancelled order; LIMIT for a 101st refund, or one that would take the order's refunds past 20000 lines. A line, a currency or a return the order has not is INVALID_ARGUMENT on its field, and so is a shipping_amount of an order that does not ship, of zero or past what is left of it. {"request_id": "…"} makes the call safe to repeat: a repeat answers the refund it recorded. Two at once never give back more than a line has: the one that comes second is checked against what the first left, or answers ABORTED. Answers 201 and the refund.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
query Parameters
validate_onlytrue runs every check and answers 200 with the resource the call would create — without name, id, etag or times — and writes nothing (§7).
Create refund › Request Body
linesWhat it gives back, line by line: [{line_id, quantity, amount, tax_amount?}]. line_id is the id of a line of the order, each line once. quantity is the units it takes off the order — units not sent, at most quantity − cancelled_quantity − fulfilled_quantity of the line; with return_id, units of the line in that return not given money back yet — or 0 for money off the line's price without units. amount is the part of the line's line_total it gives back, at most what is left of it past the line's refunded_amount; left out on Create, the units' share — line_total over quantity a unit, rounded half up to the currency's minor unit, the line's last unit taking what is left — and required when quantity is 0. tax_amount is the same share of the line's tax_amount, worked out by the server; absent on a line that was not taxed. Required on Create, but for a refund of the shipping alone (shipping_amount), which may leave it out or send it empty. Set on Create alone.
shipping_amountWhat it gives back of the order's shipping_total, a google.type.Money in the order's currency above zero — at most what is left of it past the order's shipping.refunded_amount, which goes up by it. Absent when it gives no shipping back; with it, lines may be left out. A refund that takes off the last units of an order nothing of which was sent, and the refund of :cancel, give back all that is left of the shipping, whatever was asked; a refund of a return's units gives back only what you send here. Set on Create alone.
payoutHow the money it owes (payout_amount) goes back to the customer, as the Create asked: DEFERRED — later, the default: the refund is PENDING until :mark_paid records it or :pay sends it; RECORDED — it went back already, past the platform: the order's transactions take a REFUND of it that SUCCEEDED, and the refund is SUCCEEDED at once; PROVIDER — through the payment provider now: a REFUND of each payment it is laid over, the newest first, sent to its provider at once, and the refund SUCCEEDED once they all succeed. PROVIDER takes no more than the order's provider_refundable_total (FAILED_PRECONDITION REFUND_PROVIDER_AMOUNT otherwise). Set on Create alone; ORDER_REFUND_PAYOUT_UNSPECIFIED is read as DEFERRED.
restockWhether the units it takes off the order go back to the stock of their variants, in the same write as the refund: true unless you send false — for goods damaged or lost. A variant whose stock is not tracked takes nothing back. Always false with return_id: the return's :receive puts its units back.
return_idThe return of goods whose units it gives money back for — websites/{website}/orders/{order}/returns/{return_id}, open or closed. Its lines then take units sent, of that return and not given money back yet, rather than units not sent; nothing is taken off the order nor back to the stock, and the return counts them in its refunded_quantity. Set on Create alone.
reasonWhy the money is given back, when the shop says: up to 500 characters, on one line or several.
notify_customerWhether the customer is sent the order_refunded email of the refund — what it gives back line by line, its shipping, its tax and total, and the reason — in the language of the view the order was placed on. True unless you send false; a refund that gives no money back (total zero) sends none. Read on Create alone.
request_idAn idempotency key you choose, at most 64 characters. Creating with a key the order already has a refund of answers that refund and gives nothing back again.
Create refund › Responses
With validate_only=true: the resource as it would be created; nothing written.
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 refund is: PENDING — the customer is owed its payout_amount and the money has not gone back yet, or is on its way through the payment provider; SUCCEEDED — it went back (pay_time), or nothing was owed in money. :mark_paid, and the payment provider giving back all of it, move PENDING to SUCCEEDED, and nothing moves after.
linesWhat it gives back, line by line: [{line_id, quantity, amount, tax_amount?}]. line_id is the id of a line of the order, each line once. quantity is the units it takes off the order — units not sent, at most quantity − cancelled_quantity − fulfilled_quantity of the line; with return_id, units of the line in that return not given money back yet — or 0 for money off the line's price without units. amount is the part of the line's line_total it gives back, at most what is left of it past the line's refunded_amount; left out on Create, the units' share — line_total over quantity a unit, rounded half up to the currency's minor unit, the line's last unit taking what is left — and required when quantity is 0. tax_amount is the same share of the line's tax_amount, worked out by the server; absent on a line that was not taxed. Required on Create, but for a refund of the shipping alone (shipping_amount), which may leave it out or send it empty. Set on Create alone.
shipping_amountWhat it gives back of the order's shipping_total, a google.type.Money in the order's currency above zero — at most what is left of it past the order's shipping.refunded_amount, which goes up by it. Absent when it gives no shipping back; with it, lines may be left out. A refund that takes off the last units of an order nothing of which was sent, and the refund of :cancel, give back all that is left of the shipping, whatever was asked; a refund of a return's units gives back only what you send here. Set on Create alone.
shipping_tax_amountThe same share of the shipping's tax, a google.type.Money: the order's shipping.tax_rate on shipping_amount, rounded once to the minor unit — all the shipping's tax left once its last is given back. Absent when it gives no shipping back, and when the shipping was not taxed.
tax_linesThe tax its lines and its shipping give back by name and rate, the highest rate first: [{display_name, rate, amount}], rate a percentage as a decimal string and the name the order's tax_lines give that rate. Empty when nothing of it was taxed.
totalWhat it gives back in all, a google.type.Money: the lines' amount and shipping_amount, and their tax too when the order's prices did not hold it. The order's current_total goes down by it.
payout_amountWhat of total is owed to the customer in money, a google.type.Money: what they paid beyond what the order costs after it, less what the order's other refunds still owe them — never more than total. Zero on an order nothing of which was paid: the refund only lowers what it costs.
payoutHow the money it owes (payout_amount) goes back to the customer, as the Create asked: DEFERRED — later, the default: the refund is PENDING until :mark_paid records it or :pay sends it; RECORDED — it went back already, past the platform: the order's transactions take a REFUND of it that SUCCEEDED, and the refund is SUCCEEDED at once; PROVIDER — through the payment provider now: a REFUND of each payment it is laid over, the newest first, sent to its provider at once, and the refund SUCCEEDED once they all succeed. PROVIDER takes no more than the order's provider_refundable_total (FAILED_PRECONDITION REFUND_PROVIDER_AMOUNT otherwise). Set on Create alone; ORDER_REFUND_PAYOUT_UNSPECIFIED is read as DEFERRED.
restockWhether the units it takes off the order go back to the stock of their variants, in the same write as the refund: true unless you send false — for goods damaged or lost. A variant whose stock is not tracked takes nothing back. Always false with return_id: the return's :receive puts its units back.
return_idThe return of goods whose units it gives money back for — websites/{website}/orders/{order}/returns/{return_id}, open or closed. Its lines then take units sent, of that return and not given money back yet, rather than units not sent; nothing is taken off the order nor back to the stock, and the return counts them in its refunded_quantity. Set on Create alone.
reasonWhy the money is given back, when the shop says: up to 500 characters, on one line or several.
pay_timeWhen its money went back to the customer — as the Create with "payout": "RECORDED" or :mark_paid recorded it, or when the payment provider gave the last of it back. Absent while PENDING, and when nothing was owed.
actorWho recorded the refund: {type, id?} — type USER and id the user of the account who created it.
Get refund
A refund of an order: the shop's decision that the customer gets so much money back — for units not sent, which it takes off the order, for the units of a return of goods (return_id), as money off a line's price, or of the order's shipping (shipping_amount); :cancel of the order records one of everything left. Its amounts follow the lines' prices and tax to the minor unit of the order's currency, and the order's current_total goes down by its total. What of it is owed in money (payout_amount) goes back as its payout says — later, already past the platform, or through the payment provider now — recorded as REFUNDs in the order's transactions. A refund is never edited or deleted. An order holds at most 100, of 20000 lines in all; listed the oldest first.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
refund_idId of the parent refund.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get refund › 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 refund is: PENDING — the customer is owed its payout_amount and the money has not gone back yet, or is on its way through the payment provider; SUCCEEDED — it went back (pay_time), or nothing was owed in money. :mark_paid, and the payment provider giving back all of it, move PENDING to SUCCEEDED, and nothing moves after.
linesWhat it gives back, line by line: [{line_id, quantity, amount, tax_amount?}]. line_id is the id of a line of the order, each line once. quantity is the units it takes off the order — units not sent, at most quantity − cancelled_quantity − fulfilled_quantity of the line; with return_id, units of the line in that return not given money back yet — or 0 for money off the line's price without units. amount is the part of the line's line_total it gives back, at most what is left of it past the line's refunded_amount; left out on Create, the units' share — line_total over quantity a unit, rounded half up to the currency's minor unit, the line's last unit taking what is left — and required when quantity is 0. tax_amount is the same share of the line's tax_amount, worked out by the server; absent on a line that was not taxed. Required on Create, but for a refund of the shipping alone (shipping_amount), which may leave it out or send it empty. Set on Create alone.
shipping_amountWhat it gives back of the order's shipping_total, a google.type.Money in the order's currency above zero — at most what is left of it past the order's shipping.refunded_amount, which goes up by it. Absent when it gives no shipping back; with it, lines may be left out. A refund that takes off the last units of an order nothing of which was sent, and the refund of :cancel, give back all that is left of the shipping, whatever was asked; a refund of a return's units gives back only what you send here. Set on Create alone.
shipping_tax_amountThe same share of the shipping's tax, a google.type.Money: the order's shipping.tax_rate on shipping_amount, rounded once to the minor unit — all the shipping's tax left once its last is given back. Absent when it gives no shipping back, and when the shipping was not taxed.
tax_linesThe tax its lines and its shipping give back by name and rate, the highest rate first: [{display_name, rate, amount}], rate a percentage as a decimal string and the name the order's tax_lines give that rate. Empty when nothing of it was taxed.
totalWhat it gives back in all, a google.type.Money: the lines' amount and shipping_amount, and their tax too when the order's prices did not hold it. The order's current_total goes down by it.
payout_amountWhat of total is owed to the customer in money, a google.type.Money: what they paid beyond what the order costs after it, less what the order's other refunds still owe them — never more than total. Zero on an order nothing of which was paid: the refund only lowers what it costs.
payoutHow the money it owes (payout_amount) goes back to the customer, as the Create asked: DEFERRED — later, the default: the refund is PENDING until :mark_paid records it or :pay sends it; RECORDED — it went back already, past the platform: the order's transactions take a REFUND of it that SUCCEEDED, and the refund is SUCCEEDED at once; PROVIDER — through the payment provider now: a REFUND of each payment it is laid over, the newest first, sent to its provider at once, and the refund SUCCEEDED once they all succeed. PROVIDER takes no more than the order's provider_refundable_total (FAILED_PRECONDITION REFUND_PROVIDER_AMOUNT otherwise). Set on Create alone; ORDER_REFUND_PAYOUT_UNSPECIFIED is read as DEFERRED.
restockWhether the units it takes off the order go back to the stock of their variants, in the same write as the refund: true unless you send false — for goods damaged or lost. A variant whose stock is not tracked takes nothing back. Always false with return_id: the return's :receive puts its units back.
return_idThe return of goods whose units it gives money back for — websites/{website}/orders/{order}/returns/{return_id}, open or closed. Its lines then take units sent, of that return and not given money back yet, rather than units not sent; nothing is taken off the order nor back to the stock, and the return counts them in its refunded_quantity. Set on Create alone.
reasonWhy the money is given back, when the shop says: up to 500 characters, on one line or several.
pay_timeWhen its money went back to the customer — as the Create with "payout": "RECORDED" or :mark_paid recorded it, or when the payment provider gave the last of it back. Absent while PENDING, and when nothing was owed.
actorWho recorded the refund: {type, id?} — type USER and id the user of the account who created it.
Mark paid (refund)
Records that the money of a PENDING refund went back to the customer past the platform: the order's transactions take a REFUND that SUCCEEDED of what of its payout_amount was not given back yet, its refund_id this refund's, by the calling user; the refund becomes SUCCEEDED with pay_time, and the order's outstanding_total rises back by it — PARTIALLY_REFUNDED, or REFUNDED once everything paid is given back. Takes no body. A refund SUCCEEDED already, or one with a REFUND still PENDING at the payment provider, answers FAILED_PRECONDITION REFUND_STATUS with its status, and nothing is recorded; a full journal of 100 transactions, LIMIT. Answers the refund.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
refund_idId of the parent refund.
Mark paid (refund) › Request Body optional
Mark paid (refund) › Responses
The affected resource, or the method’s own response object (§10).
Pay (refund)
Sends the money a PENDING refund owes back to the customer through the payment provider now — a refund created with "payout": "DEFERRED", or one whose payout through the provider was refused. What of its payout_amount is not given back yet is laid over the order's payments at providers, the newest first, and each gets a REFUND of its own in the order's transactions, by the calling user, sent to its provider at once: SUCCEEDED when the provider gives it back, PENDING while it is still working on it, FAILED with its failure_reason when it refuses. The refund becomes SUCCEEDED, with pay_time, once all its REFUNDs succeed. Takes no body. A refund SUCCEEDED already, or one with a REFUND still PENDING, answers FAILED_PRECONDITION REFUND_STATUS with its status; more than the payment providers can still give back (provider_refundable_total) REFUND_PROVIDER_AMOUNT with that amount; a full journal of 100 transactions LIMIT — nothing is recorded then. Answers the refund.
path Parameters
website_idId of the parent website.
order_idId of the parent order.
refund_idId of the parent refund.
Pay (refund) › Request Body optional
Pay (refund) › Responses
The affected resource, or the method’s own response object (§10).