Sales channels and point of sale
Commerce sells in more places than the storefront: Facebook and Instagram shops and TikTok through their catalogs, in person at the register, on any website through buy buttons, and to business customers at wholesale prices. Every sale is an order like any other, with its channel saying where it came from: pos, buy_button or wholesale. Reading needs commerce:read, changing commerce:write; choosing a channel’s catalog needs settings:write.
Meta and TikTok catalogs
Section titled “Meta and TikTok catalogs”| To | Operations |
|---|---|
| See where each channel stands | GET /api/v1/commerce/channels |
| List the catalogs the sign-in reaches | GET /api/v1/commerce/channels/{channel}/catalogs |
| Choose a catalog, or make one | PUT /api/v1/commerce/channels/{channel}/catalog |
| Stop syncing | DELETE /api/v1/commerce/channels/{channel}/catalog |
| Sync now | POST /api/v1/commerce/channels/{channel}/sync |
Connect Meta in Settings › Integrations and allow catalogs (Commerce › Settings asks for catalog_management and business_management), or connect TikTok, whose catalog permission is set on TikTok’s app. Then choose a catalog in a Meta business or a TikTok Business Center, or name a new one with create; a new TikTok catalog is made for the store’s country and the workspace’s currency.
From then on Digize keeps the catalog in step with Commerce, as it does Google Merchant Center: a minute after products change, the variants that changed go to the channel in batches (Meta’s items_batch, TikTok’s product upload), the ones no longer listed come off, and what the channel made of each is read back. GET /api/v1/commerce/channels counts listed, sent (waiting for the channel’s word), accepted and refused variants, with the channel’s reason for each refusal. A refused variant goes again only once it changes.
Listed are active products on the storefront that ship or download: not subscriptions, services or gift cards. Each variant is one item: its id is the variant’s, grouped by the product’s, with its title, description, the storefront’s link to it (set the storefront’s address in Commerce settings first), images, price and sale price, stock and brand.
Point of sale
Section titled “Point of sale”Commerce › Point of sale is a register for selling in person. It sells active physical, digital and service products from one location’s stock: pick the location in the page’s menu, and the stock shown and taken is that location’s. A sale takes a discount (a percentage or an amount off the sale), the store’s tax where it is, and an optional email and phone for the customer.
| To | Operations |
|---|---|
| Read the register: settings, locations, catalog with stock, waiting sales, today’s takings | GET /api/v1/commerce/pos |
| Change what it takes and prints | PATCH /api/v1/commerce/pos/settings |
| List recent sales | GET /api/v1/commerce/pos/sales |
| Take a cash sale | POST /api/v1/commerce/pos/sales/cash |
| Finish or cancel a card sale | POST /api/v1/commerce/pos/sales/{id}/finish POST /api/v1/commerce/pos/sales/{id}/cancel |
| Send the receipt by email or text | POST /api/v1/commerce/pos/sales/{id}/receipt |
| Set up card readers at a location | POST /api/v1/commerce/pos/locations/{locationId}/setup |
| List, register or remove readers | GET /api/v1/commerce/pos/locations/{locationId}/readers POST /api/v1/commerce/pos/locations/{locationId}/readers DELETE /api/v1/commerce/pos/locations/{locationId}/readers/{readerId} |
Every sale sends expectedTotal, what the register showed in minor units: a price that changed since is refused with 409 conflict, so nobody is charged a total they didn’t see. A cash sale with tendered works out the change.
Cards are taken on Stripe Terminal smart readers (BBPOS WisePOS E, Stripe Reader S700) on the workspace’s own Stripe account. Setting up a location makes its Stripe Terminal location at the store’s address; register a reader there with the pairing code it shows. In the browser the register uses Stripe’s Terminal JS SDK, with a connection token for that location’s readers (commerce.pos.connectionToken, for the register only). A card sale (commerce.pos.sales.card) makes a card-present PaymentIntent the reader collects; finishing reads it back from Stripe, and only one Stripe says succeeded becomes an order, with its stock taken. A sale the register never heard back about is looked up again ten minutes later, and cancelled after an hour unpaid. In test mode the register can use Stripe’s simulated reader.
Register sales are orders on the pos channel with nothing to ship. Cash sales record a manual payment; card sales the PaymentIntent, so refunds go back to the card as for any order. A receipt goes when asked for: by email from the store’s sending address (which needs a sending domain), or by text from the workspace’s Twilio number, ending with the register’s receipt footer.
Buy buttons
Section titled “Buy buttons”Buy buttons sell any product on another website: a Buy now button straight to Stripe’s payment page, or Add to cart with a cart drawer. Turn them on in Commerce › Settings with the websites allowed to use them; the workspace gets a key, safe to show in a page.
| To | Operations |
|---|---|
| Read the settings, key and script address | GET /api/v1/commerce/buy-buttons |
| Turn them on or off, and set the websites | PUT /api/v1/commerce/buy-buttons |
| Make a new key | POST /api/v1/commerce/buy-buttons/rotate |
<script src="https://digize.com/_platform/buy/button.js" data-key="bb_01jb8x4q2m7ktw9c3n5rvhz1de" async></script>
<!-- Buy now --><div data-digize-buy="kenya-aa"></div><!-- Add to cart, with a cart drawer --><div data-digize-buy="kenya-aa" data-cart></div>Each div names a product by its slug. data-label changes the button’s words, and data-show="button" draws the button alone. The script talks to the app’s origin, and every call is refused unless the page’s origin is one of the key’s websites: products come from the same copy of the catalog storefronts read, and Stripe sends the shopper back to the page with ?checkout=, which the script reads to thank them and empty the cart. Orders come in on the buy_button channel. This is separate from Digize sites, which call /_platform/store/ with the site’s own identity.
Wholesale
Section titled “Wholesale”Approved business customers buy at wholesale prices. A price list takes a percentage off every product, fixes the price of the ones it names, and can set a minimum order. A customer signed in to the storefront (with the code emailed from the store’s address) who has an approved account pays their list’s prices at every checkout: on the wholesale portal, on a Digize site, or through a buy button. Products whose only sales channel is Wholesale portal sell only to them.
| To | Operations |
|---|---|
| Read the settings, lists and accounts | GET /api/v1/commerce/wholesale |
| Change the settings | PATCH /api/v1/commerce/wholesale/settings |
| Read, save or delete a price list | GET /api/v1/commerce/wholesale/lists/{id} POST /api/v1/commerce/wholesale/lists DELETE /api/v1/commerce/wholesale/lists/{id} |
| Approve, decline or open an account | PUT /api/v1/commerce/wholesale/accounts/{contactId} |
| Close an account | DELETE /api/v1/commerce/wholesale/accounts/{contactId} |
The wholesale portal is at /shop/wholesale/<workspace> on the app’s address (portalUrl). A business customer signs in with their email, asks for an account when they have none (while applications is on), and once approved orders from the catalog at their prices and pays on Stripe’s page; the order is on the wholesale channel. Owners and admins are told of each request. Accounts without a list of their own buy from the default list. Digize sites can show the same: see Storefront › Wholesale.