Skip to content
Coritan Docs

Organization API: Commerce Store API: Store

The 45 Organization API operations for store.

View as Markdown

Part of Commerce Store API.

Method Path Summary
GET /api/v1/orgs/{org_slug}/store Store info
POST /api/v1/orgs/{org_slug}/store/affiliates/hits One click on a referral link today (UTC); 204 whether or not the code counted
GET /api/v1/orgs/{org_slug}/store/affiliates/me The shopper's own affiliate record and the program's terms
POST /api/v1/orgs/{org_slug}/store/affiliates/me Make the shopper an affiliate with the code they ask for, or one made up
POST /api/v1/orgs/{org_slug}/store/affiliates/me/claims Claim the next reward the shopper has earned
GET /api/v1/orgs/{org_slug}/store/affiliates/program The program's public terms, for the storefront's cookie and its signup page
GET /api/v1/orgs/{org_slug}/store/affiliates/validate {valid}: whether the code belongs to an active affiliate while the program is on
POST /api/v1/orgs/{org_slug}/store/carts A cart in the key's mode and sales channel, in a region and its currency
GET /api/v1/orgs/{org_slug}/store/carts/recover The cart an abandoned cart or failed payment email links to, while it is open
GET /api/v1/orgs/{org_slug}/store/carts/{cart_id} Get cart
PATCH /api/v1/orgs/{org_slug}/store/carts/{cart_id} Email, addresses, region or country (re-prices every line), note, locale, metadata
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/complete Place the cart's order: {"order", "accesstoken"}
GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees Every fee the cart is offered, with selected: the same list as the cart's fees
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees/{code} Select an offered fee
DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees/{code} Turn an offered fee off; the choice is kept even for a fee on by default
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/gift-cards Apply a gift card by its code: 10 attempts per 10 minutes per cart and per client IP
DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/gift-cards/{gift_card_id} Remove gift card
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items Add a variant; the same variant with the same metadata merges into its line
PATCH /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items/{line_id} Set a line's quantity; 0 removes it
DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items/{line_id} Delete line item
GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/payment-providers The providers that can take this cart's payment, and whether it needs one
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/payment-sessions Start the payment with provider, or refresh the one already started for the same amount
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/promotions Apply a code
DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/promotions Remove a code, named in the body {"code"} or as ?code=
POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/shipping-methods Choose an option; it replaces the method its shipping profile had
GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/shipping-options The options the cart's address and items allow, priced for them, per shipping profile
GET /api/v1/orgs/{org_slug}/store/categories The active, public categories as a tree, by rank and then name
GET /api/v1/orgs/{org_slug}/store/categories/{handle} Get category
GET /api/v1/orgs/{org_slug}/store/collections List collections
GET /api/v1/orgs/{org_slug}/store/collections/{handle} A published collection; its products are /store/products?collectionhandle=
GET /api/v1/orgs/{org_slug}/store/feeds/microsoft-ads.csv The store's offline conversions, as the CSV file Microsoft Ads imports on a schedule
POST /api/v1/orgs/{org_slug}/store/leads Record a sign-up
POST /api/v1/orgs/{org_slug}/store/leads/impressions One more view of a popup design today (UTC)
POST /api/v1/orgs/{org_slug}/store/orders/lookup Look up orders
GET /api/v1/orgs/{org_slug}/store/orders/{order_id} Get order
POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/conversions/microsoft-ads/claim Claim microsoft ads
GET /api/v1/orgs/{org_slug}/store/orders/{order_id}/documents The invoice and credit notes, as issued by the seller of record
POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/heard-about Keep the shopper's answer to the thank-you page's "How did you first hear about us?"
GET /api/v1/orgs/{org_slug}/store/orders/{order_id}/returns The order's returns, oldest first
POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/returns Request return
POST /api/v1/orgs/{org_slug}/store/payment-returns/maef Receive maef return
GET /api/v1/orgs/{org_slug}/store/regions The regions the store sells in, by name, to pick a country and currency from
GET /api/v1/orgs/{org_slug}/store/regions/{region_id} Get region
GET /api/v1/orgs/{org_slug}/store/return-reasons List return reasons
POST /api/v1/orgs/{org_slug}/store/unsubscribe Suppress the token's address for this store's marketing emails

GET /api/v1/orgs/{org_slug}/store

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

One click on a referral link today (UTC); 204 whether or not the code counted

Section titled One click on a referral link today (UTC); 204 whether or not the code counted

POST /api/v1/orgs/{org_slug}/store/affiliates/hits

One click on a referral link today (UTC); 204 whether or not the code counted.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
code string yes The code in the /ref/CODE/ link the shopper followed.
Status Meaning
204 Success.
422 The request is not valid. detail lists each problem.

The shopper's own affiliate record and the program's terms

Section titled The shopper's own affiliate record and the program's terms

GET /api/v1/orgs/{org_slug}/store/affiliates/me

The shopper's own affiliate record and the program's terms.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Make the shopper an affiliate with the code they ask for, or one made up

Section titled Make the shopper an affiliate with the code they ask for, or one made up

POST /api/v1/orgs/{org_slug}/store/affiliates/me

Make the shopper an affiliate with the code they ask for, or one made up.

Name In Type Required
org_slug path string yes

application/json

Field Type Required Description
code string or null no The code the shopper wants; one is made up without it.
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

Claim the next reward the shopper has earned

Section titled Claim the next reward the shopper has earned

POST /api/v1/orgs/{org_slug}/store/affiliates/me/claims

Claim the next reward the shopper has earned.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
variant_id Variant Id yes One of the program's reward_variant_ids.
shipping_address Shipping Address yes Where the reward is sent.
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

The program's public terms, for the storefront's cookie and its signup page

Section titled The program's public terms, for the storefront's cookie and its signup page

GET /api/v1/orgs/{org_slug}/store/affiliates/program

The program's public terms, for the storefront's cookie and its signup page.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

{valid}: whether the code belongs to an active affiliate while the program is on

Section titled {valid}: whether the code belongs to an active affiliate while the program is on

GET /api/v1/orgs/{org_slug}/store/affiliates/validate

{valid}: whether the code belongs to an active affiliate while the program is on.

Name In Type Required Description
org_slug path string yes
code query string no The code to check.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

A cart in the key's mode and sales channel, in a region and its currency

Section titled A cart in the key's mode and sales channel, in a region and its currency

POST /api/v1/orgs/{org_slug}/store/carts

A cart in the key's mode and sales channel, in a region and its currency.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required
region_id integer or null no
country_code string or null no
currency_code string or null no
email string or null no
sales_channel_id integer or null no
locale string or null no
metadata object or null no
items array of LineItemIn or null no
items[].variant_id integer yes
items[].quantity integer no
items[].metadata object or null no
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

The cart an abandoned cart or failed payment email links to, while it is open

Section titled The cart an abandoned cart or failed payment email links to, while it is open

GET /api/v1/orgs/{org_slug}/store/carts/recover

The cart an abandoned cart or failed payment email links to, while it is open.

Name In Type Required Description
org_slug path string yes
t query string yes The token from the email's cart link.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}

Name In Type Required
cart_id path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Email, addresses, region or country (re-prices every line), note, locale, metadata

Section titled Email, addresses, region or country (re-prices every line), note, locale, metadata

PATCH /api/v1/orgs/{org_slug}/store/carts/{cart_id}

Email, addresses, region or country (re-prices every line), note, locale, metadata.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required
email string or null no
shipping_address object or null no
billing_address object or null no
region_id integer or null no
country_code string or null no
note string or null no
locale string or null no
metadata object or null no
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Place the cart's order: {"order", "accesstoken"}

Section titled Place the cart's order: {"order", "accesstoken"}

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/complete

Place the cart's order: {"order", "access_token"}. The token is what the shopper's order link carries (GET /store/orders/{id}?token=).

create_account: true from a guest asks for an account with the cart's email once the order is placed, with password (8 to 128 characters, 422 without create_account) or, without one, a link to choose it by email (app/commerce/accounts.py). It runs once the answer is sent, on the first answer and on every retry, never makes a second account and never changes the answer, so the answer does not say whether the email already had an account.

Name In Type Required
cart_id path string yes
org_slug path string yes
Idempotency-Key header string or null no

application/json

Field Type Required Description
accept_terms boolean no
create_account boolean no A guest asks for an account with the cart's email once the order is placed.
password string or null no The new account's password; only with create_account. Without one, a link to choose it is emailed.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Every fee the cart is offered, with selected: the same list as the cart's fees

Section titled Every fee the cart is offered, with selected: the same list as the cart's fees

GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees

Every fee the cart is offered, with selected: the same list as the cart's fees.

Name In Type Required
cart_id path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees/{code}

Select an offered fee. 404 not_found for a code the cart is not offered.

Name In Type Required
cart_id path string yes
code path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Turn an offered fee off; the choice is kept even for a fee on by default

Section titled Turn an offered fee off; the choice is kept even for a fee on by default

DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/fees/{code}

Turn an offered fee off; the choice is kept even for a fee on by default.

Name In Type Required
cart_id path string yes
code path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Apply a gift card by its code: 10 attempts per 10 minutes per cart and per client IP

Section titled Apply a gift card by its code: 10 attempts per 10 minutes per cart and per client IP

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/gift-cards

Apply a gift card by its code: 10 attempts per 10 minutes per cart and per client IP.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required
code string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/gift-cards/{gift_card_id}

Name In Type Required
cart_id path string yes
gift_card_id path integer yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Add a variant; the same variant with the same metadata merges into its line

Section titled Add a variant; the same variant with the same metadata merges into its line

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items

Add a variant; the same variant with the same metadata merges into its line.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required
variant_id integer yes
quantity integer no
metadata object or null no
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Set a line's quantity; 0 removes it

Section titled Set a line's quantity; 0 removes it

PATCH /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items/{line_id}

Set a line's quantity; 0 removes it.

Name In Type Required
cart_id path string yes
line_id path integer yes
org_slug path string yes

application/json (required)

Field Type Required
quantity integer yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/line-items/{line_id}

Name In Type Required
cart_id path string yes
line_id path integer yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

The providers that can take this cart's payment, and whether it needs one

Section titled The providers that can take this cart's payment, and whether it needs one

GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/payment-providers

The providers that can take this cart's payment, and whether it needs one.

external is the store's own payment page: its config holds the display_name, description and card brands to show.

route is the cart's payment route (default or rollout) when the store routes payments (settings.payment_routing), else null; only the providers on that route are listed, and the first listing assigns it.

Name In Type Required
cart_id path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Start the payment with provider, or refresh the one already started for the same amount

Section titled Start the payment with provider, or refresh the one already started for the same amount

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/payment-sessions

Start the payment with provider, or refresh the one already started for the same amount. accept_terms records the shopper's acceptance of the store's terms with the session.

paypal sends the shopper away and back: return_url and cancel_url must be on the storefront (its /checkout page when left out). external hands the cart to the store's MAEF parent site and answers redirect_url, the parent's payment page; the parent sends the shopper back to the storefront's /thank-you, whose query the storefront passes to POST /store/payment-returns/maef. Starting again for the same cart answers the same page; a changed cart gets a new one. A changed cart also cancels the old session, and for a card payment its intent at Stripe, so a form left open in another tab cannot pay it. 422 with field storefront_url when the store has no storefront address; 502 payment_provider_error when the parent refuses the cart.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required Description
provider string yes stripe, paypal, manual or external.
accept_terms boolean no
return_url string or null no
cancel_url string or null no
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/promotions

Apply a code. 422 promotion_not_applicable says why in reason.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required
code string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Remove a code, named in the body {"code"} or as ?code=

Section titled Remove a code, named in the body {"code"} or as ?code=

DELETE /api/v1/orgs/{org_slug}/store/carts/{cart_id}/promotions

Remove a code, named in the body {"code"} or as ?code=.

Name In Type Required
cart_id path string yes
org_slug path string yes
code query string or null no

application/json

Field Type Required
code string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Choose an option; it replaces the method its shipping profile had

Section titled Choose an option; it replaces the method its shipping profile had

POST /api/v1/orgs/{org_slug}/store/carts/{cart_id}/shipping-methods

Choose an option; it replaces the method its shipping profile had.

Name In Type Required
cart_id path string yes
org_slug path string yes

application/json (required)

Field Type Required
option_id integer yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

The options the cart's address and items allow, priced for them, per shipping profile

Section titled The options the cart's address and items allow, priced for them, per shipping profile

GET /api/v1/orgs/{org_slug}/store/carts/{cart_id}/shipping-options

The options the cart's address and items allow, priced for them, per shipping profile.

Name In Type Required
cart_id path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

The active, public categories as a tree, by rank and then name

Section titled The active, public categories as a tree, by rank and then name

GET /api/v1/orgs/{org_slug}/store/categories

The active, public categories as a tree, by rank and then name. A category that is inactive or internal hides the categories under it too.

limit and offset page the top-level categories, and each one comes with every category under it. count is how many top-level categories there are, so a store with up to 200 of them gets its whole tree on the first page.

Name In Type Required Description
org_slug path string yes
limit query integer no How many top-level categories to return, 1–200. The default is 200. Default: 200.
offset query integer no How many top-level categories to skip, for the next page. count in the answer says how many there are in all. Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/categories/{handle}

Name In Type Required
handle path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/collections

Name In Type Required Description
org_slug path string yes
limit query integer no Default: 50.
offset query integer no Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

A published collection; its products are /store/products?collectionhandle=

Section titled A published collection; its products are /store/products?collectionhandle=

GET /api/v1/orgs/{org_slug}/store/collections/{handle}

A published collection; its products are /store/products?collection_handle=.

Name In Type Required
handle path string yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

The store's offline conversions, as the CSV file Microsoft Ads imports on a schedule

Section titled The store's offline conversions, as the CSV file Microsoft Ads imports on a schedule

GET /api/v1/orgs/{org_slug}/store/feeds/microsoft-ads.csv

The store's offline conversions, as the CSV file Microsoft Ads imports on a schedule.

Microsoft Ads fetches this URL itself. Copy the whole URL from the store's Microsoft Ads integration, which answers it once (when the integration is first turned on, and when its URL is replaced), into a schedule under Conversions > Offline conversions > Schedules in Microsoft Advertising. It needs no publishable key: the token in the URL is the credential.

The file lists the store's live orders that are paid (captured or partly refunded), placed in the last lookback_days (30 unless set), placed at least browser_grace_minutes ago (120 unless set) and placed after the integration was turned on. It leaves out test, canceled, refunded and imported orders, and every order the thank-you page reported with the UET tag (POST .../store/orders/{order_id}/conversions/microsoft-ads/claim). An order the file lists stays listed on later fetches within the lookback, and Microsoft Ads drops the repeats.

The first line is Parameters:TimeZone=+0000, then the header Microsoft Click Id, Conversion Name, Conversion Time, Conversion Value, Conversion Currency and Hashed Email Address, then a row per order, oldest first. Every cell is in double quotes and every line ends in CRLF. A row holds the click id the storefront saved in the cart's metadata.tracking.msclkid (32 hex digits or a GUID, without a leading _uet), the integration's conversion_name, the time the order was placed in UTC as MM/DD/YYYY HH:MM:SS, the total with two decimals, the currency code, and the SHA-256 of the shopper's email address in lower case, with the dots and anything from a + taken out of the part before the @. An order without a valid click id is listed on its email hash alone when email_only_rows is on (the default) and the visit came from Microsoft: a click id was saved, or metadata.tracking.source names Bing, Yahoo, DuckDuckGo, Ecosia, MSN or AOL. In test mode the file has the header and no rows.

At most 30 requests an hour from one IP address for one store's feed (429 rate_limited).

Name In Type Required Description
org_slug path string yes
token query string or null no The feed token, as it is in the feed URL the integration answered.
Status Meaning
200 The CSV file.
404 The token is wrong or missing, the store is unknown or closed, or its Microsoft Ads integration is off.
429 More than 30 requests in an hour from one IP address for this feed.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/leads

Record a sign-up. Always {"ok": true} for a valid address.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
email string yes
source string or null no Where the storefront collected it, such as welcome_popup.
variant string or null no The popup design the shopper signed up through.
consent boolean or null no Whether the shopper agreed to marketing email.
consent_text string or null no The words the shopper agreed to.
metadata object or null no
turnstile_token string or null no
Status Meaning
202 Success.
422 The request is not valid. detail lists each problem.

One more view of a popup design today (UTC)

Section titled One more view of a popup design today (UTC)

POST /api/v1/orgs/{org_slug}/store/leads/impressions

One more view of a popup design today (UTC).

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
variant string yes The popup design the storefront showed.
Status Meaning
204 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/orders/lookup

Email the links to the orders placed with email (in the key's mode, within the store's order link lifetime). Always {"sent": true}; the email goes out after the answer, and only when there are orders.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
email string yes
order_number string or null no #1001 or 1001: only that order.
Status Meaning
202 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/orders/{order_id}

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/conversions/microsoft-ads/claim

Ask whether the thank-you page should report this purchase to Microsoft Ads with the UET tag.

Call it once the order is placed, before firing the UET purchase event, and fire the event only when the answer is {"fire": true}. That answer comes once for each order. Every other call answers {"fire": false}: a repeat, a call for an order the store's Microsoft Ads feed has already listed, a call for a test, unpaid, canceled or imported order, and every call while the store's Microsoft Ads integration is off or in test mode. The feed leaves out an order the browser reported, and the browser never reports an order the feed listed, so Microsoft Ads counts each purchase once.

Send the publishable key with the shopper's Bearer token, or with the order link's token (what completing the checkout answered as access_token), as for GET /store/orders/{order_id}. At most 10 calls an hour for one order, and 600 an hour from one IP address (429 rate_limited); the feed then lists the order instead.

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token, when no shopper is signed in.
Status Meaning
200 Success.
404 The order does not exist, is another shopper's or the key's other mode's, or the token is wrong.
429 Too many claims for this order, or from one IP address. The order is then left to the feed.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
fire boolean True once for each order: report the purchase with the UET tag now. False means Microsoft Ads counts it another way, or not at all.

The invoice and credit notes, as issued by the seller of record

Section titled The invoice and credit notes, as issued by the seller of record

GET /api/v1/orgs/{org_slug}/store/orders/{order_id}/documents

The invoice and credit notes, as issued by the seller of record.

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Keep the shopper's answer to the thank-you page's "How did you first hear about us?"

Section titled Keep the shopper's answer to the thank-you page's "How did you first hear about us?"

POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/heard-about

Keep the shopper's answer to the thank-you page's "How did you first hear about us?".

Call it once the order is placed, with the answer the shopper picked (source, such as google_search) and, for an "other" option, their words in detail. The storefront owns the set of options; this keeps whatever source it sends. The first answer for an order stays: a later call answers {"saved": false} with the answer already there, so the question can be asked again safely. The answer rides in the order's metadata.heard_about (source, answered_at, and detail when given), which GET /store/orders/{order_id} returns.

Send the publishable key with the shopper's Bearer token, or with the order link's token (what completing the checkout answered as access_token), as for GET /store/orders/{order_id}. At most 20 answers an hour for one order, and 120 an hour from one IP address (429 rate_limited).

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token, when no shopper is signed in.

application/json (required)

Field Type Required Description
source string yes The option the shopper picked, such as google_search: 1 to 40 letters, digits, hyphens or underscores. The storefront owns the set of options.
detail string or null no Free text for an 'other' option; kept on one line to 200 characters, empty treated as none.
Status Meaning
200 Success.
404 The order does not exist, is another shopper's or the key's other mode's, or the token is wrong.
422 The source is missing or not 1 to 40 letters, digits, hyphens or underscores.
429 Too many answers for this order, or from one IP address.

Fields of a 200 response:

Field Type Description
saved boolean True when this answer was kept, false when the order already had one.
heard_about Heard About The answer on the order: source, answered_at, and detail when given.

The order's returns, oldest first

Section titled The order's returns, oldest first

GET /api/v1/orgs/{org_slug}/store/orders/{order_id}/returns

The order's returns, oldest first.

An order has at most 50 returns, so the first page holds them all. count is how many returns the order has.

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token.
limit query integer no How many returns to return, 1–200. The default is 200. Default: 200.
offset query integer no How many returns to skip, for the next page. count in the answer says how many there are in all. Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/orders/{order_id}/returns

Ask to return shipped units, or to exchange them: requested until the store approves or declines it.

Name In Type Required Description
order_id path string yes
org_slug path string yes
token query string or null no The order link's token.
Idempotency-Key header string or null no

application/json (required)

Field Type Required Description
items array of ReturnItemIn yes
items[].order_item_id integer yes
items[].quantity integer yes
items[].reason_code string or null no The code of a return reason.
items[].note string or null no
exchange_items array of ExchangeItemIn or null no
exchange_items[].variant_id integer yes
exchange_items[].quantity integer yes
note string or null no
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

POST /api/v1/orgs/{org_slug}/store/payment-returns/maef

Pass on what the MAEF parent sent the shopper back with, and learn what became of the payment.

After paying on the parent's page, the shopper lands on the storefront's /thank-you with maef_complete, sig and maef_parent in the query. Send that query string as query, untouched. We check sig with the secret of each of the store's payment pages, refuse a return signed more than 15 minutes ago, and keep each return once, so sending it again answers what the first one came to.

outcome is placed (the cart is an order: order_id, and completing cart_id answers it), processing (the parent holds the payment for review, or the order is still being placed), failed (the parent reports the payment failed; the shopper may pay again) or review (the parent took a payment that could not pay for an order; the store refunds it at the parent). cart_id is the cart the payment was for, or null when it named none of the store's payments.

The checks run in this order, and a return stops at the first one it fails:

  1. 422 invalid_return for a query without maef_complete and a 64 character sig. It counts against no limit.
  2. 401 invalid_signature when no page's secret makes the sig. Each one counts against the store's limit for wrong signatures, 60 in 10 minutes; past it the answer is 429 rate_limited.
  3. 429 rate_limited once the store has had 600 returns with a good signature in 10 minutes. Wrong signatures never count here, so they cannot use up the room real returns need.
  4. 410 return_expired past 15 minutes. Otherwise the answer above.
Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
query string yes The query string the MAEF parent sent the shopper back with, as it arrived: maef_complete, sig and maef_parent.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

The regions the store sells in, by name, to pick a country and currency from

Section titled The regions the store sells in, by name, to pick a country and currency from

GET /api/v1/orgs/{org_slug}/store/regions

The regions the store sells in, by name, to pick a country and currency from.

A store has at most 50 regions, so the first page holds them all. count is how many regions the store sells in.

Name In Type Required Description
org_slug path string yes
limit query integer no How many regions to return, 1–200. The default is 200. Default: 200.
offset query integer no How many regions to skip, for the next page. count in the answer says how many there are in all. Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/regions/{region_id}

Name In Type Required
region_id path integer yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

GET /api/v1/orgs/{org_slug}/store/return-reasons

The reasons a shopper may pick for a return, in the store's order, leaving out those it disabled. An item's reason_code takes a code. count is how many reasons a shopper may pick, across every page.

Name In Type Required Description
org_slug path string yes
limit query integer no How many reasons to return, 1–200. The default is 200. Default: 200.
offset query integer no How many reasons to skip, for the next page. count in the answer says how many there are in all. Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Suppress the token's address for this store's marketing emails

Section titled Suppress the token's address for this store's marketing emails

POST /api/v1/orgs/{org_slug}/store/unsubscribe

Suppress the token's address for this store's marketing emails. No publishable key.

Name In Type Required Description
org_slug path string yes
t query string or null no The token from the email's unsubscribe link.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.