Draft orders
The orders the shop puts together itself — taken by phone, by email, at the counter — before they are placed: a view, lines, the customer or a guest, the addresses, the ways to ship and to pay. Every write prices the draft as the checkout prices a cart and says what still keeps it from being placed (completion_issues).
List draft orders
Lists the website's draft orders, the most recently changed first, without their lines — and without payment_methods and completion_issues, which a Get works out: a List prices nothing. filter takes status (status = "OPEN"), customer_id, create_time and update_time; order_by takes update_time and create_time.
path Parameters
website_idId of the parent website.
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: update_time desc. Sortable: create_time, update_time.
filterAIP-160 subset (§8). Filterable: create_time, customer_id, status, update_time. A field outside the list is INVALID_ARGUMENT.
List draft orders › Responses
One page of draft_orders.
This page of draft_orders, 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 draft order
Starts a draft order: view_id — an active view of the website, whether its storefront sells or not, else INVALID_ARGUMENT on it — and, all optional, its first lines ([{variant_id, quantity}], at most 250, each refused on lines[i].<field>), customer_id, email, display_name, the addresses, tax_id, shipping_method, payment_method, payment_window_minutes, note and staff_note, each as Update writes it. The draft is OPEN, made by the calling user (create_actor), priced at once as the website's checkout prices a cart — a customer's at their groups' prices, a tracked variant held to its stock (FAILED_PRECONDITION OUT_OF_STOCK, each violation with variant_id and available) — and says what keeps it from being an order (completion_issues). None of the storefront's checkout settings hold the shop's users: a guest's order where guests may not check out, a view whose storefront does not sell, either offline way to pay, and every online way of a payment provider connected and switched on that takes the draft's currency. ?validate_only=true answers 200 and the draft it would make — without name, id or times — and makes nothing. Answers 201 and the draft; its lines are read at …/lines.
path Parameters
website_idId of the parent website.
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 draft order › Request Body
view_idThe view of the website the order is placed on — an active one, whether its storefront sells or not: its market prices every line, in its currency, and names the products in its language. Required on create. Written again, the draft moves to that view: every line is priced there, a line it does not sell or price is taken out, and a shipping address outside its market is dropped — price_changes says what moved, and ?validate_only=true shows it first.
customer_idThe website's customer the order is for — websites/{website}/customers/{customer_id}; absent, the order is a guest's. Written, every line is priced for the customer's groups, and email and display_name not written beside it are taken from the customer; an id the website has no customer of is refused on it. null under update_mask makes it a guest's again, at a guest's prices.
emailThe address the order's letters go to, lowercased as an order keeps it. Required before the draft is completed (EMAIL_REQUIRED).
display_nameThe name the order is placed under, at most 200 characters. Required before the draft is completed (DISPLAY_NAME_REQUIRED).
shipping_addressWhere the order goes and to whom, written whole: {recipient_name?, organization?, country_code, region?, sublocality?, city?, postal_code?, address_line1, street_number?, address_line2?, phone?}, the country ISO 3166-1 alpha-2 and the parts its address format requires (address_formats/{country_code}), each part wrong refused on shipping_address.<part>. Its country must be one the draft's market sells to — else refused on shipping_address.country_code. The draft is taxed by it and offered the ways to ship there (shipping_methods). A phone is never required. null under update_mask clears it.
billing_addressWhom and where the order is billed to, of the parts of shipping_address and written whole the same way; absent, the order is billed to its shipping address. null under update_mask clears it.
tax_idThe customer's tax number as typed, at most 64 characters: read as a number of the payer's country — the billing address's, else the shipping address's — once there is an address, and refused on it when it is none of that country's.
shipping_methodThe code of the way to ship chosen, one of shipping_methods — a code the draft is not offered is SHIPPING_METHOD_UNAVAILABLE — kept while it is offered; else, and until one is written, the first offer. null under update_mask forgets the choice. manual:custom while the draft has its own shipping: a provider's code written — or null — takes that off. Absent without an offer.
custom_shippingThe draft's own shipping, set by hand instead of what the providers offer: {display_name?, amount}, amount a google.type.Money in the draft's currency to its minor unit, never below zero — zero ships it free — display_name the name the customer reads, at most 100 characters; without one, the word the order's letters label the shipping with in the language of the draft's view («Shipping», «Versand»). Offered as manual:custom after the providers' offers and chosen — so it is taxed as the shipping is and in total — on a website that ships nothing too, and to an address nothing is offered for; a recalculation keeps it while the draft stays in its currency (another one takes it off: price_changes.custom_shipping_dropped). The order ships by it: shipping.provider manual. Refused CUSTOM_SHIPPING_DISABLED where the draft's capabilities do not name CUSTOM_SHIPPING; a shipping_method other than manual:custom beside it is refused on shipping_method. null under update_mask — the providers' first offer again. Absent while the draft ships by what is offered.
payment_methodHow the customer pays, one of payment_methods — a way to pay the draft is not given now is PAYMENT_METHOD_UNAVAILABLE, a code that is no way to pay at all is refused on it. Required before the draft is completed (PAYMENT_METHOD_REQUIRED). An online way's order is placed unpaid and waits for its payment for payment_window_minutes; one whose provider was disconnected since it was chosen keeps the draft from its order (PAYMENT_METHOD_UNAVAILABLE in completion_issues).
payment_window_minutesHow long the order of an online way to pay waits for its payment from its placement, in whole minutes: 30 to 43200 (thirty days). The order's units stay off the stock all that time; unpaid at its end, the order is cancelled and its units are back in stock. Absent — the window the website gives its own checkout (checkout.payment_window_minutes), or the one of the way to pay's provider; null under update_mask clears it. An offline way to pay does not read it.
noteWhat the customer asked to add for the shop, at most 2,000 characters over several lines — the order's note, shown to them as theirs.
staff_noteWhat the shop's users write on the order for each other, at most 2,000 characters over several lines — the order's staff_note; the customer never sees it.
source_order_idThe order the draft was made a copy of, websites/{website}/orders/{source_order_id} — sent on Create alone, and then alone in the body: any other field beside it is refused on itself. The copy is on the order's view — one no longer active is refused on source_order_id — for its customer, with its contact, its addresses and its tax number; its variants and quantities are the lines, priced today, and the way to ship it was sent by is chosen again while it is offered. Neither its way to pay nor its notes are copied. What the copy changed — a price, a line no longer sold, the way to ship, an address the market no longer sells to — is price_changes, ORDER_COPIED; a line short of the stock is an OUT_OF_STOCK issue. Absent on a draft made otherwise.
linesThe draft's first lines, on Create alone: [{variant_id, quantity}], at most 250, each as a line's Create takes one — a refused one is named lines[i].<field>, and nothing is created. Never in an answer: the lines are read at draft_orders/{draft_order}/lines.
Create draft order › 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).
statusOPEN while the shop puts it together — every write takes it; COMPLETED once it was made an order (order_id): it takes no write and no Delete any more, and is read as it was then.
view_idThe view of the website the order is placed on — an active one, whether its storefront sells or not: its market prices every line, in its currency, and names the products in its language. Required on create. Written again, the draft moves to that view: every line is priced there, a line it does not sell or price is taken out, and a shipping address outside its market is dropped — price_changes says what moved, and ?validate_only=true shows it first.
market_idThe market of the draft's view — websites/{website}/catalog_markets/{market_id} — empty when the view names none. Read when the draft is made on the view or moved to it, and whenever every line is priced.
currency_codeThe currency of every price of the draft: its market's, read with market_id.
prices_include_taxWhether the draft's prices hold the tax already: the mode of its market when the tax was last worked out. False, the tax comes on top of them.
customer_idThe website's customer the order is for — websites/{website}/customers/{customer_id}; absent, the order is a guest's. Written, every line is priced for the customer's groups, and email and display_name not written beside it are taken from the customer; an id the website has no customer of is refused on it. null under update_mask makes it a guest's again, at a guest's prices.
emailThe address the order's letters go to, lowercased as an order keeps it. Required before the draft is completed (EMAIL_REQUIRED).
display_nameThe name the order is placed under, at most 200 characters. Required before the draft is completed (DISPLAY_NAME_REQUIRED).
group_idsThe customer groups the draft's prices were last resolved for — its customer's then; empty for a guest's.
shipping_addressWhere the order goes and to whom, written whole: {recipient_name?, organization?, country_code, region?, sublocality?, city?, postal_code?, address_line1, street_number?, address_line2?, phone?}, the country ISO 3166-1 alpha-2 and the parts its address format requires (address_formats/{country_code}), each part wrong refused on shipping_address.<part>. Its country must be one the draft's market sells to — else refused on shipping_address.country_code. The draft is taxed by it and offered the ways to ship there (shipping_methods). A phone is never required. null under update_mask clears it.
billing_addressWhom and where the order is billed to, of the parts of shipping_address and written whole the same way; absent, the order is billed to its shipping address. null under update_mask clears it.
tax_idThe customer's tax number as typed, at most 64 characters: read as a number of the payer's country — the billing address's, else the shipping address's — once there is an address, and refused on it when it is none of that country's.
shipping_requiredWhether the website ships what it sells: a shipping provider of it is on and ready. True, the draft is offered ways to ship (shipping_methods) once it has a shipping address and a line.
shipping_methodsThe ways to ship the draft is offered for its shipping address and its lines, in the order to show them, asked of the providers again by every write: [{code, provider, display_name, description?, amount, delivery_days_min?, delivery_days_max?}], amount a google.type.Money in the draft's currency, the names in the language of its view. Last, while the draft has its own shipping (custom_shipping), the offer of it: manual:custom of the provider manual. Empty without an address, without a line, or where nothing ships — but for that one.
shipping_methodThe code of the way to ship chosen, one of shipping_methods — a code the draft is not offered is SHIPPING_METHOD_UNAVAILABLE — kept while it is offered; else, and until one is written, the first offer. null under update_mask forgets the choice. manual:custom while the draft has its own shipping: a provider's code written — or null — takes that off. Absent without an offer.
shipping_totalWhat the way to ship chosen costs, a google.type.Money in total; its tax is in tax_lines and tax_total. Absent without a way chosen.
custom_shippingThe draft's own shipping, set by hand instead of what the providers offer: {display_name?, amount}, amount a google.type.Money in the draft's currency to its minor unit, never below zero — zero ships it free — display_name the name the customer reads, at most 100 characters; without one, the word the order's letters label the shipping with in the language of the draft's view («Shipping», «Versand»). Offered as manual:custom after the providers' offers and chosen — so it is taxed as the shipping is and in total — on a website that ships nothing too, and to an address nothing is offered for; a recalculation keeps it while the draft stays in its currency (another one takes it off: price_changes.custom_shipping_dropped). The order ships by it: shipping.provider manual. Refused CUSTOM_SHIPPING_DISABLED where the draft's capabilities do not name CUSTOM_SHIPPING; a shipping_method other than manual:custom beside it is refused on shipping_method. null under update_mask — the providers' first offer again. Absent while the draft ships by what is offered.
payment_methodsThe ways to pay the draft may be given now: BANK_TRANSFER and CASH_ON_DELIVERY, then every online way of a payment provider the website has connected and switched on that takes the draft's currency — whatever the website's checkout.payment_methods offers its visitors. An online way means the customer pays the order on their own, at the provider. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it.
payment_methodHow the customer pays, one of payment_methods — a way to pay the draft is not given now is PAYMENT_METHOD_UNAVAILABLE, a code that is no way to pay at all is refused on it. Required before the draft is completed (PAYMENT_METHOD_REQUIRED). An online way's order is placed unpaid and waits for its payment for payment_window_minutes; one whose provider was disconnected since it was chosen keeps the draft from its order (PAYMENT_METHOD_UNAVAILABLE in completion_issues).
payment_window_minutesHow long the order of an online way to pay waits for its payment from its placement, in whole minutes: 30 to 43200 (thirty days). The order's units stay off the stock all that time; unpaid at its end, the order is cancelled and its units are back in stock. Absent — the window the website gives its own checkout (checkout.payment_window_minutes), or the one of the way to pay's provider; null under update_mask clears it. An offline way to pay does not read it.
noteWhat the customer asked to add for the shop, at most 2,000 characters over several lines — the order's note, shown to them as theirs.
staff_noteWhat the shop's users write on the order for each other, at most 2,000 characters over several lines — the order's staff_note; the customer never sees it.
line_countHow many lines the draft holds — one per variant, at most 250. The lines are read and written at draft_orders/{draft_order}/lines.
subtotalWhat the lines come to: the sum of their line_total, a google.type.Money in the draft's currency.
tax_linesThe tax of the lines and of the shipping by name and rate, the highest rate first: [{display_name, rate, amount}], rate a percentage as a decimal string. Empty when nothing is taxed.
tax_totalThe tax of the draft: the sum of its lines' tax_amount and of its shipping's tax, a google.type.Money, zero when nothing is taxed.
totalWhat the order costs: subtotal + shipping_total + tax_total while the tax comes on top of the prices, subtotal + shipping_total while they hold it.
repriced_atWhen every line was last priced at once. A Get or a write of an open draft priced more than ten minutes ago prices every line again and writes the draft so, price_changes saying what moved.
price_changesWhat the last pricing of every line moved, when it moved something: {change_time, reason, previous_total, lines [{line_id, sku, previous_unit_price, unit_price}], removed_lines [{variant_id, sku, quantity, reason}], previous_shipping_method?, destination_dropped?, price_overrides_dropped?, custom_shipping_dropped?}. reason — REPRICED (the prices were due again), VIEW_CHANGED, CUSTOMER_CHANGED, ORDER_COPIED (made of an order, previous_total and the previous prices the order's); a line taken out for NOT_SOLD, NO_PRICE or NO_VARIANT; destination_dropped — the shipping address went with a market that no longer sells there; price_overrides_dropped — how many lines lost their own price, given in a currency the draft is no longer in; custom_shipping_dropped — the draft's own shipping went for the same reason. A line with its own price is never among lines: its price is the shop's, whatever the catalog says now. The next write of the shop that moves nothing of the kind itself clears it. Absent when there is nothing to say.
completion_issuesWhy the draft cannot be made an order now — empty, it can: [{type, field?, line_id?, available?, description}], in the order the draft is put together. type — LINES_REQUIRED, EMAIL_REQUIRED, DISPLAY_NAME_REQUIRED, SHIPPING_ADDRESS_REQUIRED, SHIPPING_METHOD_REQUIRED (ways are offered, none chosen), SHIPPING_UNAVAILABLE (nothing is offered for the address and the lines), PAYMENT_METHOD_REQUIRED, FIELD_INVALID (a field kept no longer passes its check — field its path), OUT_OF_STOCK (the line line_id holds more than the available units in stock), PAYMENT_METHOD_UNAVAILABLE (the way to pay chosen is not among payment_methods any more: its provider was disconnected or switched off, or the draft moved to a currency it does not take) — or, where the shop limits its users, CUSTOMER_REQUIRED, PHONE_REQUIRED, TAX_ID_REQUIRED, BILLING_ADDRESS_DISABLED, VIEW_NOT_SELLING, PRICE_OVERRIDE_DISABLED (the line line_id holds an own price its users may no longer give), CUSTOM_SHIPPING_DISABLED (the draft holds an own shipping its users may no longer give). With an own shipping, neither SHIPPING_UNAVAILABLE nor SHIPPING_METHOD_REQUIRED is said. field names the field to fix. Worked out for every Get and every write — the stock of every line — and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
capabilitiesWhat the shop's user may do with the draft beyond what the website's checkout does: PRICE_OVERRIDE — give a line its own price (a line's price_override); CUSTOM_SHIPPING — give the draft its own shipping (custom_shipping). A lever not named here is refused when written, and a screen shows it not. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
create_actorWho made the draft: {type: "USER", id}, the user of the account whose token created it.
source_order_idThe order the draft was made a copy of, websites/{website}/orders/{source_order_id} — sent on Create alone, and then alone in the body: any other field beside it is refused on itself. The copy is on the order's view — one no longer active is refused on source_order_id — for its customer, with its contact, its addresses and its tax number; its variants and quantities are the lines, priced today, and the way to ship it was sent by is chosen again while it is offered. Neither its way to pay nor its notes are copied. What the copy changed — a price, a line no longer sold, the way to ship, an address the market no longer sells to — is price_changes, ORDER_COPIED; a line short of the stock is an OUT_OF_STOCK issue. Absent on a draft made otherwise.
order_idThe order a COMPLETED draft became, websites/{website}/orders/{order_id}.
order_numberThe website's number of that order.
complete_timeWhen the draft was made an order.
expire_timeWhen the draft is deleted: a year past its last change — a COMPLETED one a year past its completion. Every write moves it.
Get draft order
Reads a draft order, its payment_methods and its completion_issues worked out now — by the stock of every line. An open draft priced more than ten minutes ago, or for groups its customer is no longer in, is priced again first and written so: what moved is its price_changes (REPRICED), and a line no longer sold is taken out. A COMPLETED one is read as it was made an order.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get draft order › 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).
statusOPEN while the shop puts it together — every write takes it; COMPLETED once it was made an order (order_id): it takes no write and no Delete any more, and is read as it was then.
view_idThe view of the website the order is placed on — an active one, whether its storefront sells or not: its market prices every line, in its currency, and names the products in its language. Required on create. Written again, the draft moves to that view: every line is priced there, a line it does not sell or price is taken out, and a shipping address outside its market is dropped — price_changes says what moved, and ?validate_only=true shows it first.
market_idThe market of the draft's view — websites/{website}/catalog_markets/{market_id} — empty when the view names none. Read when the draft is made on the view or moved to it, and whenever every line is priced.
currency_codeThe currency of every price of the draft: its market's, read with market_id.
prices_include_taxWhether the draft's prices hold the tax already: the mode of its market when the tax was last worked out. False, the tax comes on top of them.
customer_idThe website's customer the order is for — websites/{website}/customers/{customer_id}; absent, the order is a guest's. Written, every line is priced for the customer's groups, and email and display_name not written beside it are taken from the customer; an id the website has no customer of is refused on it. null under update_mask makes it a guest's again, at a guest's prices.
emailThe address the order's letters go to, lowercased as an order keeps it. Required before the draft is completed (EMAIL_REQUIRED).
display_nameThe name the order is placed under, at most 200 characters. Required before the draft is completed (DISPLAY_NAME_REQUIRED).
group_idsThe customer groups the draft's prices were last resolved for — its customer's then; empty for a guest's.
shipping_addressWhere the order goes and to whom, written whole: {recipient_name?, organization?, country_code, region?, sublocality?, city?, postal_code?, address_line1, street_number?, address_line2?, phone?}, the country ISO 3166-1 alpha-2 and the parts its address format requires (address_formats/{country_code}), each part wrong refused on shipping_address.<part>. Its country must be one the draft's market sells to — else refused on shipping_address.country_code. The draft is taxed by it and offered the ways to ship there (shipping_methods). A phone is never required. null under update_mask clears it.
billing_addressWhom and where the order is billed to, of the parts of shipping_address and written whole the same way; absent, the order is billed to its shipping address. null under update_mask clears it.
tax_idThe customer's tax number as typed, at most 64 characters: read as a number of the payer's country — the billing address's, else the shipping address's — once there is an address, and refused on it when it is none of that country's.
shipping_requiredWhether the website ships what it sells: a shipping provider of it is on and ready. True, the draft is offered ways to ship (shipping_methods) once it has a shipping address and a line.
shipping_methodsThe ways to ship the draft is offered for its shipping address and its lines, in the order to show them, asked of the providers again by every write: [{code, provider, display_name, description?, amount, delivery_days_min?, delivery_days_max?}], amount a google.type.Money in the draft's currency, the names in the language of its view. Last, while the draft has its own shipping (custom_shipping), the offer of it: manual:custom of the provider manual. Empty without an address, without a line, or where nothing ships — but for that one.
shipping_methodThe code of the way to ship chosen, one of shipping_methods — a code the draft is not offered is SHIPPING_METHOD_UNAVAILABLE — kept while it is offered; else, and until one is written, the first offer. null under update_mask forgets the choice. manual:custom while the draft has its own shipping: a provider's code written — or null — takes that off. Absent without an offer.
shipping_totalWhat the way to ship chosen costs, a google.type.Money in total; its tax is in tax_lines and tax_total. Absent without a way chosen.
custom_shippingThe draft's own shipping, set by hand instead of what the providers offer: {display_name?, amount}, amount a google.type.Money in the draft's currency to its minor unit, never below zero — zero ships it free — display_name the name the customer reads, at most 100 characters; without one, the word the order's letters label the shipping with in the language of the draft's view («Shipping», «Versand»). Offered as manual:custom after the providers' offers and chosen — so it is taxed as the shipping is and in total — on a website that ships nothing too, and to an address nothing is offered for; a recalculation keeps it while the draft stays in its currency (another one takes it off: price_changes.custom_shipping_dropped). The order ships by it: shipping.provider manual. Refused CUSTOM_SHIPPING_DISABLED where the draft's capabilities do not name CUSTOM_SHIPPING; a shipping_method other than manual:custom beside it is refused on shipping_method. null under update_mask — the providers' first offer again. Absent while the draft ships by what is offered.
payment_methodsThe ways to pay the draft may be given now: BANK_TRANSFER and CASH_ON_DELIVERY, then every online way of a payment provider the website has connected and switched on that takes the draft's currency — whatever the website's checkout.payment_methods offers its visitors. An online way means the customer pays the order on their own, at the provider. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it.
payment_methodHow the customer pays, one of payment_methods — a way to pay the draft is not given now is PAYMENT_METHOD_UNAVAILABLE, a code that is no way to pay at all is refused on it. Required before the draft is completed (PAYMENT_METHOD_REQUIRED). An online way's order is placed unpaid and waits for its payment for payment_window_minutes; one whose provider was disconnected since it was chosen keeps the draft from its order (PAYMENT_METHOD_UNAVAILABLE in completion_issues).
payment_window_minutesHow long the order of an online way to pay waits for its payment from its placement, in whole minutes: 30 to 43200 (thirty days). The order's units stay off the stock all that time; unpaid at its end, the order is cancelled and its units are back in stock. Absent — the window the website gives its own checkout (checkout.payment_window_minutes), or the one of the way to pay's provider; null under update_mask clears it. An offline way to pay does not read it.
noteWhat the customer asked to add for the shop, at most 2,000 characters over several lines — the order's note, shown to them as theirs.
staff_noteWhat the shop's users write on the order for each other, at most 2,000 characters over several lines — the order's staff_note; the customer never sees it.
line_countHow many lines the draft holds — one per variant, at most 250. The lines are read and written at draft_orders/{draft_order}/lines.
subtotalWhat the lines come to: the sum of their line_total, a google.type.Money in the draft's currency.
tax_linesThe tax of the lines and of the shipping by name and rate, the highest rate first: [{display_name, rate, amount}], rate a percentage as a decimal string. Empty when nothing is taxed.
tax_totalThe tax of the draft: the sum of its lines' tax_amount and of its shipping's tax, a google.type.Money, zero when nothing is taxed.
totalWhat the order costs: subtotal + shipping_total + tax_total while the tax comes on top of the prices, subtotal + shipping_total while they hold it.
repriced_atWhen every line was last priced at once. A Get or a write of an open draft priced more than ten minutes ago prices every line again and writes the draft so, price_changes saying what moved.
price_changesWhat the last pricing of every line moved, when it moved something: {change_time, reason, previous_total, lines [{line_id, sku, previous_unit_price, unit_price}], removed_lines [{variant_id, sku, quantity, reason}], previous_shipping_method?, destination_dropped?, price_overrides_dropped?, custom_shipping_dropped?}. reason — REPRICED (the prices were due again), VIEW_CHANGED, CUSTOMER_CHANGED, ORDER_COPIED (made of an order, previous_total and the previous prices the order's); a line taken out for NOT_SOLD, NO_PRICE or NO_VARIANT; destination_dropped — the shipping address went with a market that no longer sells there; price_overrides_dropped — how many lines lost their own price, given in a currency the draft is no longer in; custom_shipping_dropped — the draft's own shipping went for the same reason. A line with its own price is never among lines: its price is the shop's, whatever the catalog says now. The next write of the shop that moves nothing of the kind itself clears it. Absent when there is nothing to say.
completion_issuesWhy the draft cannot be made an order now — empty, it can: [{type, field?, line_id?, available?, description}], in the order the draft is put together. type — LINES_REQUIRED, EMAIL_REQUIRED, DISPLAY_NAME_REQUIRED, SHIPPING_ADDRESS_REQUIRED, SHIPPING_METHOD_REQUIRED (ways are offered, none chosen), SHIPPING_UNAVAILABLE (nothing is offered for the address and the lines), PAYMENT_METHOD_REQUIRED, FIELD_INVALID (a field kept no longer passes its check — field its path), OUT_OF_STOCK (the line line_id holds more than the available units in stock), PAYMENT_METHOD_UNAVAILABLE (the way to pay chosen is not among payment_methods any more: its provider was disconnected or switched off, or the draft moved to a currency it does not take) — or, where the shop limits its users, CUSTOMER_REQUIRED, PHONE_REQUIRED, TAX_ID_REQUIRED, BILLING_ADDRESS_DISABLED, VIEW_NOT_SELLING, PRICE_OVERRIDE_DISABLED (the line line_id holds an own price its users may no longer give), CUSTOM_SHIPPING_DISABLED (the draft holds an own shipping its users may no longer give). With an own shipping, neither SHIPPING_UNAVAILABLE nor SHIPPING_METHOD_REQUIRED is said. field names the field to fix. Worked out for every Get and every write — the stock of every line — and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
capabilitiesWhat the shop's user may do with the draft beyond what the website's checkout does: PRICE_OVERRIDE — give a line its own price (a line's price_override); CUSTOM_SHIPPING — give the draft its own shipping (custom_shipping). A lever not named here is refused when written, and a screen shows it not. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
create_actorWho made the draft: {type: "USER", id}, the user of the account whose token created it.
source_order_idThe order the draft was made a copy of, websites/{website}/orders/{source_order_id} — sent on Create alone, and then alone in the body: any other field beside it is refused on itself. The copy is on the order's view — one no longer active is refused on source_order_id — for its customer, with its contact, its addresses and its tax number; its variants and quantities are the lines, priced today, and the way to ship it was sent by is chosen again while it is offered. Neither its way to pay nor its notes are copied. What the copy changed — a price, a line no longer sold, the way to ship, an address the market no longer sells to — is price_changes, ORDER_COPIED; a line short of the stock is an OUT_OF_STOCK issue. Absent on a draft made otherwise.
order_idThe order a COMPLETED draft became, websites/{website}/orders/{order_id}.
order_numberThe website's number of that order.
complete_timeWhen the draft was made an order.
expire_timeWhen the draft is deleted: a year past its last change — a COMPLETED one a year past its completion. Every write moves it.
Delete draft order
Deletes an open draft order, its lines with it; nothing else changes — no stock was held for it. A COMPLETED draft is its order's record and answers FAILED_PRECONDITION DRAFT_ORDER_COMPLETED. If-Match holds the delete to the draft as last read.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Delete draft order › Responses
Deleted. No body (§7).
Update draft order
Writes the draft's fields: view_id — another view: the draft goes to its market and currency, every line priced there, the lines it does not sell or price taken out and a shipping address outside its market dropped, price_changes VIEW_CHANGED saying so; customer_id — every line priced for the customer's groups (CUSTOMER_CHANGED), email and display_name not written beside it taken from the customer, null a guest's again; shipping_address — the ways to ship offered there, the first chosen; shipping_method — one of them, else FAILED_PRECONDITION SHIPPING_METHOD_UNAVAILABLE with the shipping_methods offered; payment_method — one of payment_methods, else PAYMENT_METHOD_UNAVAILABLE with them; payment_window_minutes — how long the order of an online way to pay waits for its payment, 30 to 43200 minutes, else INVALID_ARGUMENT on it; email, display_name, billing_address, tax_id, note, staff_note. null under update_mask clears a field. lines is refused: the lines are written at …/lines. If-Match holds the write to the draft as last read — ABORTED with the draft as it is otherwise. ?validate_only=true answers the draft as the write would leave it, writing nothing: a move to another view is previewed so. A COMPLETED draft answers FAILED_PRECONDITION DRAFT_ORDER_COMPLETED. Answers the draft.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
query Parameters
update_maskComma-separated field paths to merge. A field named here and sent as null is cleared; without the mask a null is dropped (§7, §11).
validate_onlytrue runs every check and answers the resource as the write would leave it, and writes nothing (§7).
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Update draft order › Request Body
view_idThe view of the website the order is placed on — an active one, whether its storefront sells or not: its market prices every line, in its currency, and names the products in its language. Required on create. Written again, the draft moves to that view: every line is priced there, a line it does not sell or price is taken out, and a shipping address outside its market is dropped — price_changes says what moved, and ?validate_only=true shows it first.
customer_idThe website's customer the order is for — websites/{website}/customers/{customer_id}; absent, the order is a guest's. Written, every line is priced for the customer's groups, and email and display_name not written beside it are taken from the customer; an id the website has no customer of is refused on it. null under update_mask makes it a guest's again, at a guest's prices.
emailThe address the order's letters go to, lowercased as an order keeps it. Required before the draft is completed (EMAIL_REQUIRED).
display_nameThe name the order is placed under, at most 200 characters. Required before the draft is completed (DISPLAY_NAME_REQUIRED).
shipping_addressWhere the order goes and to whom, written whole: {recipient_name?, organization?, country_code, region?, sublocality?, city?, postal_code?, address_line1, street_number?, address_line2?, phone?}, the country ISO 3166-1 alpha-2 and the parts its address format requires (address_formats/{country_code}), each part wrong refused on shipping_address.<part>. Its country must be one the draft's market sells to — else refused on shipping_address.country_code. The draft is taxed by it and offered the ways to ship there (shipping_methods). A phone is never required. null under update_mask clears it.
billing_addressWhom and where the order is billed to, of the parts of shipping_address and written whole the same way; absent, the order is billed to its shipping address. null under update_mask clears it.
tax_idThe customer's tax number as typed, at most 64 characters: read as a number of the payer's country — the billing address's, else the shipping address's — once there is an address, and refused on it when it is none of that country's.
shipping_methodThe code of the way to ship chosen, one of shipping_methods — a code the draft is not offered is SHIPPING_METHOD_UNAVAILABLE — kept while it is offered; else, and until one is written, the first offer. null under update_mask forgets the choice. manual:custom while the draft has its own shipping: a provider's code written — or null — takes that off. Absent without an offer.
custom_shippingThe draft's own shipping, set by hand instead of what the providers offer: {display_name?, amount}, amount a google.type.Money in the draft's currency to its minor unit, never below zero — zero ships it free — display_name the name the customer reads, at most 100 characters; without one, the word the order's letters label the shipping with in the language of the draft's view («Shipping», «Versand»). Offered as manual:custom after the providers' offers and chosen — so it is taxed as the shipping is and in total — on a website that ships nothing too, and to an address nothing is offered for; a recalculation keeps it while the draft stays in its currency (another one takes it off: price_changes.custom_shipping_dropped). The order ships by it: shipping.provider manual. Refused CUSTOM_SHIPPING_DISABLED where the draft's capabilities do not name CUSTOM_SHIPPING; a shipping_method other than manual:custom beside it is refused on shipping_method. null under update_mask — the providers' first offer again. Absent while the draft ships by what is offered.
payment_methodHow the customer pays, one of payment_methods — a way to pay the draft is not given now is PAYMENT_METHOD_UNAVAILABLE, a code that is no way to pay at all is refused on it. Required before the draft is completed (PAYMENT_METHOD_REQUIRED). An online way's order is placed unpaid and waits for its payment for payment_window_minutes; one whose provider was disconnected since it was chosen keeps the draft from its order (PAYMENT_METHOD_UNAVAILABLE in completion_issues).
payment_window_minutesHow long the order of an online way to pay waits for its payment from its placement, in whole minutes: 30 to 43200 (thirty days). The order's units stay off the stock all that time; unpaid at its end, the order is cancelled and its units are back in stock. Absent — the window the website gives its own checkout (checkout.payment_window_minutes), or the one of the way to pay's provider; null under update_mask clears it. An offline way to pay does not read it.
noteWhat the customer asked to add for the shop, at most 2,000 characters over several lines — the order's note, shown to them as theirs.
staff_noteWhat the shop's users write on the order for each other, at most 2,000 characters over several lines — the order's staff_note; the customer never sees it.
linesThe draft's first lines, on Create alone: [{variant_id, quantity}], at most 250, each as a line's Create takes one — a refused one is named lines[i].<field>, and nothing is created. Never in an answer: the lines are read at draft_orders/{draft_order}/lines.
Update draft order › Responses
The updated 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).
statusOPEN while the shop puts it together — every write takes it; COMPLETED once it was made an order (order_id): it takes no write and no Delete any more, and is read as it was then.
view_idThe view of the website the order is placed on — an active one, whether its storefront sells or not: its market prices every line, in its currency, and names the products in its language. Required on create. Written again, the draft moves to that view: every line is priced there, a line it does not sell or price is taken out, and a shipping address outside its market is dropped — price_changes says what moved, and ?validate_only=true shows it first.
market_idThe market of the draft's view — websites/{website}/catalog_markets/{market_id} — empty when the view names none. Read when the draft is made on the view or moved to it, and whenever every line is priced.
currency_codeThe currency of every price of the draft: its market's, read with market_id.
prices_include_taxWhether the draft's prices hold the tax already: the mode of its market when the tax was last worked out. False, the tax comes on top of them.
customer_idThe website's customer the order is for — websites/{website}/customers/{customer_id}; absent, the order is a guest's. Written, every line is priced for the customer's groups, and email and display_name not written beside it are taken from the customer; an id the website has no customer of is refused on it. null under update_mask makes it a guest's again, at a guest's prices.
emailThe address the order's letters go to, lowercased as an order keeps it. Required before the draft is completed (EMAIL_REQUIRED).
display_nameThe name the order is placed under, at most 200 characters. Required before the draft is completed (DISPLAY_NAME_REQUIRED).
group_idsThe customer groups the draft's prices were last resolved for — its customer's then; empty for a guest's.
shipping_addressWhere the order goes and to whom, written whole: {recipient_name?, organization?, country_code, region?, sublocality?, city?, postal_code?, address_line1, street_number?, address_line2?, phone?}, the country ISO 3166-1 alpha-2 and the parts its address format requires (address_formats/{country_code}), each part wrong refused on shipping_address.<part>. Its country must be one the draft's market sells to — else refused on shipping_address.country_code. The draft is taxed by it and offered the ways to ship there (shipping_methods). A phone is never required. null under update_mask clears it.
billing_addressWhom and where the order is billed to, of the parts of shipping_address and written whole the same way; absent, the order is billed to its shipping address. null under update_mask clears it.
tax_idThe customer's tax number as typed, at most 64 characters: read as a number of the payer's country — the billing address's, else the shipping address's — once there is an address, and refused on it when it is none of that country's.
shipping_requiredWhether the website ships what it sells: a shipping provider of it is on and ready. True, the draft is offered ways to ship (shipping_methods) once it has a shipping address and a line.
shipping_methodsThe ways to ship the draft is offered for its shipping address and its lines, in the order to show them, asked of the providers again by every write: [{code, provider, display_name, description?, amount, delivery_days_min?, delivery_days_max?}], amount a google.type.Money in the draft's currency, the names in the language of its view. Last, while the draft has its own shipping (custom_shipping), the offer of it: manual:custom of the provider manual. Empty without an address, without a line, or where nothing ships — but for that one.
shipping_methodThe code of the way to ship chosen, one of shipping_methods — a code the draft is not offered is SHIPPING_METHOD_UNAVAILABLE — kept while it is offered; else, and until one is written, the first offer. null under update_mask forgets the choice. manual:custom while the draft has its own shipping: a provider's code written — or null — takes that off. Absent without an offer.
shipping_totalWhat the way to ship chosen costs, a google.type.Money in total; its tax is in tax_lines and tax_total. Absent without a way chosen.
custom_shippingThe draft's own shipping, set by hand instead of what the providers offer: {display_name?, amount}, amount a google.type.Money in the draft's currency to its minor unit, never below zero — zero ships it free — display_name the name the customer reads, at most 100 characters; without one, the word the order's letters label the shipping with in the language of the draft's view («Shipping», «Versand»). Offered as manual:custom after the providers' offers and chosen — so it is taxed as the shipping is and in total — on a website that ships nothing too, and to an address nothing is offered for; a recalculation keeps it while the draft stays in its currency (another one takes it off: price_changes.custom_shipping_dropped). The order ships by it: shipping.provider manual. Refused CUSTOM_SHIPPING_DISABLED where the draft's capabilities do not name CUSTOM_SHIPPING; a shipping_method other than manual:custom beside it is refused on shipping_method. null under update_mask — the providers' first offer again. Absent while the draft ships by what is offered.
payment_methodsThe ways to pay the draft may be given now: BANK_TRANSFER and CASH_ON_DELIVERY, then every online way of a payment provider the website has connected and switched on that takes the draft's currency — whatever the website's checkout.payment_methods offers its visitors. An online way means the customer pays the order on their own, at the provider. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it.
payment_methodHow the customer pays, one of payment_methods — a way to pay the draft is not given now is PAYMENT_METHOD_UNAVAILABLE, a code that is no way to pay at all is refused on it. Required before the draft is completed (PAYMENT_METHOD_REQUIRED). An online way's order is placed unpaid and waits for its payment for payment_window_minutes; one whose provider was disconnected since it was chosen keeps the draft from its order (PAYMENT_METHOD_UNAVAILABLE in completion_issues).
payment_window_minutesHow long the order of an online way to pay waits for its payment from its placement, in whole minutes: 30 to 43200 (thirty days). The order's units stay off the stock all that time; unpaid at its end, the order is cancelled and its units are back in stock. Absent — the window the website gives its own checkout (checkout.payment_window_minutes), or the one of the way to pay's provider; null under update_mask clears it. An offline way to pay does not read it.
noteWhat the customer asked to add for the shop, at most 2,000 characters over several lines — the order's note, shown to them as theirs.
staff_noteWhat the shop's users write on the order for each other, at most 2,000 characters over several lines — the order's staff_note; the customer never sees it.
line_countHow many lines the draft holds — one per variant, at most 250. The lines are read and written at draft_orders/{draft_order}/lines.
subtotalWhat the lines come to: the sum of their line_total, a google.type.Money in the draft's currency.
tax_linesThe tax of the lines and of the shipping by name and rate, the highest rate first: [{display_name, rate, amount}], rate a percentage as a decimal string. Empty when nothing is taxed.
tax_totalThe tax of the draft: the sum of its lines' tax_amount and of its shipping's tax, a google.type.Money, zero when nothing is taxed.
totalWhat the order costs: subtotal + shipping_total + tax_total while the tax comes on top of the prices, subtotal + shipping_total while they hold it.
repriced_atWhen every line was last priced at once. A Get or a write of an open draft priced more than ten minutes ago prices every line again and writes the draft so, price_changes saying what moved.
price_changesWhat the last pricing of every line moved, when it moved something: {change_time, reason, previous_total, lines [{line_id, sku, previous_unit_price, unit_price}], removed_lines [{variant_id, sku, quantity, reason}], previous_shipping_method?, destination_dropped?, price_overrides_dropped?, custom_shipping_dropped?}. reason — REPRICED (the prices were due again), VIEW_CHANGED, CUSTOMER_CHANGED, ORDER_COPIED (made of an order, previous_total and the previous prices the order's); a line taken out for NOT_SOLD, NO_PRICE or NO_VARIANT; destination_dropped — the shipping address went with a market that no longer sells there; price_overrides_dropped — how many lines lost their own price, given in a currency the draft is no longer in; custom_shipping_dropped — the draft's own shipping went for the same reason. A line with its own price is never among lines: its price is the shop's, whatever the catalog says now. The next write of the shop that moves nothing of the kind itself clears it. Absent when there is nothing to say.
completion_issuesWhy the draft cannot be made an order now — empty, it can: [{type, field?, line_id?, available?, description}], in the order the draft is put together. type — LINES_REQUIRED, EMAIL_REQUIRED, DISPLAY_NAME_REQUIRED, SHIPPING_ADDRESS_REQUIRED, SHIPPING_METHOD_REQUIRED (ways are offered, none chosen), SHIPPING_UNAVAILABLE (nothing is offered for the address and the lines), PAYMENT_METHOD_REQUIRED, FIELD_INVALID (a field kept no longer passes its check — field its path), OUT_OF_STOCK (the line line_id holds more than the available units in stock), PAYMENT_METHOD_UNAVAILABLE (the way to pay chosen is not among payment_methods any more: its provider was disconnected or switched off, or the draft moved to a currency it does not take) — or, where the shop limits its users, CUSTOMER_REQUIRED, PHONE_REQUIRED, TAX_ID_REQUIRED, BILLING_ADDRESS_DISABLED, VIEW_NOT_SELLING, PRICE_OVERRIDE_DISABLED (the line line_id holds an own price its users may no longer give), CUSTOM_SHIPPING_DISABLED (the draft holds an own shipping its users may no longer give). With an own shipping, neither SHIPPING_UNAVAILABLE nor SHIPPING_METHOD_REQUIRED is said. field names the field to fix. Worked out for every Get and every write — the stock of every line — and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
capabilitiesWhat the shop's user may do with the draft beyond what the website's checkout does: PRICE_OVERRIDE — give a line its own price (a line's price_override); CUSTOM_SHIPPING — give the draft its own shipping (custom_shipping). A lever not named here is refused when written, and a screen shows it not. Worked out for every Get and every write and kept nowhere: a List's rows do not carry it; empty for a COMPLETED draft.
create_actorWho made the draft: {type: "USER", id}, the user of the account whose token created it.
source_order_idThe order the draft was made a copy of, websites/{website}/orders/{source_order_id} — sent on Create alone, and then alone in the body: any other field beside it is refused on itself. The copy is on the order's view — one no longer active is refused on source_order_id — for its customer, with its contact, its addresses and its tax number; its variants and quantities are the lines, priced today, and the way to ship it was sent by is chosen again while it is offered. Neither its way to pay nor its notes are copied. What the copy changed — a price, a line no longer sold, the way to ship, an address the market no longer sells to — is price_changes, ORDER_COPIED; a line short of the stock is an OUT_OF_STOCK issue. Absent on a draft made otherwise.
order_idThe order a COMPLETED draft became, websites/{website}/orders/{order_id}.
order_numberThe website's number of that order.
complete_timeWhen the draft was made an order.
expire_timeWhen the draft is deleted: a year past its last change — a COMPLETED one a year past its completion. Every write moves it.
Complete (draft order)
Makes the draft an order, as the website's checkout places one: the stock of every tracked variant taken, the website's next number, the order placed — origin DRAFT_ORDER, its create_actor the calling user, its draft_order_id this draft's, its staff_note the draft's, no cart_id — and the draft COMPLETED with its order_id, order_number and complete_time, all in one transaction. Every line is priced again first. Paid by an offline way, the order waits for its money — orders/{order}:mark_paid records it — and the customer and the shop are sent the emails of the order placed; {"notify_customer": false} sends the shop's alone, and the order's :resend_notification sends the customer's later. Paid by an online way, the order waits for the customer to pay it at the provider until its payment_due_time — the draft's payment_window_minutes after its placement, or the window of the website's own checkout without one — and is cancelled unpaid then, its units back in stock; the emails of the order placed go once it is paid. Such an order costing something is paid by its link, the order's payment_uri: the storefront's page where the customer pays it, signed in or not, in any view of the website — one whose storefront does not sell among them. If-Match is required — the etag of the draft as last read, so the order is the one its user saw: without it FAILED_PRECONDITION MISSING_IF_MATCH, a stale one ABORTED with the draft as it is. Safe to repeat: a draft completed already answers itself, its order the same, whatever etag it is sent with, and two calls at once place one order. FAILED_PRECONDITION answers, no order placed: DRAFT_ORDER_INCOMPLETE with the draft's completion_issues; DRAFT_ORDER_REPRICED with the new subtotal, shipping_total, tax_total and total — the prices moved since the draft was read, the draft written so, its price_changes saying what moved: read it again and complete it; SHIPPING_METHOD_UNAVAILABLE — its way to ship is no longer offered; OUT_OF_STOCK with each variant short and its available units; MODULE_DISABLED. ?validate_only=true makes every check and answers the draft as it is, still OPEN: nothing is placed, no stock or number taken. Answers the draft.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
query Parameters
validate_onlytrue makes every check and answers the draft as it is, still OPEN: no order is placed, no stock and no number taken (§7).
Headers
If-MatchThe etag of the draft as last read. Absent: FAILED_PRECONDITION MISSING_IF_MATCH; stale: ABORTED with the draft as it is — unless the draft is completed already, which answers itself (§14, §15).
Complete (draft order) › Request Body optional
Complete (draft order) › Responses
The affected resource, or the method’s own response object (§10).
Search variants (draft orders)
Finds the variants a draft order is put together from, before any draft is made: view_id — required, an active view of the website, else INVALID_ARGUMENT on it — query, the text a product's name or an SKU of its variants holds, case aside (every product without it), and customer_id — the prices are that customer's groups', a guest's without it; one the website has not is INVALID_ARGUMENT on it. The products are found as the List of catalog_products finds display_name:"…" OR sku:"…", by name, the first page_size — 20 by default, at most 50; no pages: a long list is narrowed by query. Answers {"variants": […]}, every variant of each product, up to 250 in all.
path Parameters
website_idId of the parent website.
query Parameters
view_idThe view the draft is put together on — an active view of the website, else INVALID_ARGUMENT on view_id: its market prices the variants, in its currency, and names the products in its language.
queryThe text a product’s name, or an SKU of one of its variants, holds — case aside, at most 200 characters. Absent: every product.
customer_idThe customer of the website the prices are for — their groups’ prices; one the website has not is INVALID_ARGUMENT on customer_id. Absent: a guest’s prices.
page_sizeHow many products, by name: 20 by default, at most 50 — more is clamped (§8). There are no pages: a long list is narrowed by query.
Search variants (draft orders) › Responses
The method’s own response object (§10).