Commerce
Sales channels
Where products are sold, and how publishable API keys pick the channel.
A sales channel is a place you sell: a storefront, a buyer portal, a mobile app, or an integration. One tenant can run several storefronts by giving each its own channel.
What a channel controls
| Rule | |
|---|---|
| Products | A product is sold only in the channels it is added to. Store routes return only products in the request's channels. |
| Stock | A stock location serves only the channels linked to it. Availability counts only those locations. |
| Carts and orders | Every cart and order belongs to exactly one channel. |
| Disabled channels | A cart can't be created in a disabled channel. |
Publishable API keys
Every store request sends a publishable API key in x-publishable-api-key. The key decides which channels the request can see. Keys are not secret; they are meant to ship in browser code.
- A key is linked to one or more channels. Manage the links with Manage sales channels.
- When you create a cart without
sales_channel_id:
| Key has | Result |
|---|---|
| No channels | The cart gets the store's default sales channel. |
| One channel | The cart gets that channel. |
| Several channels | 400. Send sales_channel_id. |
- A
sales_channel_idthat isn't linked to the key fails with400. - A revoked key stops working on every store route.
curl -X POST http://localhost:9000/store/carts \
-H "x-publishable-api-key: pk_..." \
-H "Content-Type: application/json" \
-d '{ "region_id": "reg_...", "sales_channel_id": "sc_..." }'Publishable keys only scope store requests. They grant no admin access. Admin and server integrations use a secret API key. See Authentication.
Admin routes
- Sales channels, and add or remove products
- API keys: create, revoke, and link channels
- Link a stock location to channels