← DW Alliance app

DW Alliance store

An online store built into every DW Alliance brand: a product catalog, carts, checkout, invoices, payment records and shipments, all in US dollars. Your customers shop on your own domain; you manage the store with your DW Alliance session.

How it fits together

Who can do what

WhoHow they are recognisedCan
VisitorNothing. Calls are made on the store's own domain.Browse products, categories and search; build a cart.
CustomerSigned in on the store's domain with an email code (a secure cookie, 30 days).Everything a visitor can, plus addresses, checkout, own invoices, payment records and shipment tracking.
Store staffsession and brand from /session/ in the JSON body.Manage products, variants, descriptions, images, categories, invoices, payments and shipments. Needs SUPER_ADMIN, a STORE right on the brand (CREATE, UPDATE, DELETE, READ or WRITE), or to be an EDITOR of a domain owned by the company concerned.

STORE rights are granted like any other right with /permissions/. Domain editors can manage the products and categories of the company that owns their domain.

Set up a store

  1. Have a DW Alliance account and brand (/account_setup/) and a company on it.
  2. Claim your domain with /domain/ for that company and point it at DW Alliance hosting (steps 4 to 7 on the app home page).
  3. Start a staff session with /session/.
  4. Create categories and products (below). Upload product photos with /files/ and attach them.
  5. Build your shop pages as normal HTML files on your domain. They call the store endpoints on the same domain with fetch().

Products, variants and categories

Create a product

POST https://app.dwalliance.com/store/product/
{"action":"create","session":"...","brand":"...","company_id":"...",
 "name":"Kona Coffee 1 lb","price":"24.00","stock":40,
 "description":"Medium roast from Holualoa."}

The answer has product_id, slug (made from the name and unique on the brand), the default variant_id and the description_id. Leave stock out to not track stock.

Variants

Descriptions and images

Categories

Several sellers

Action claim on /store/product/ lets another company on the brand sell the same product. A cart is always for one company; if a product has several sellers the cart must say which (company_id).

Retiring a product

Set active to false to hide it. Products that are already in a cart or an order cannot be deleted, so past orders stay complete.

Customer accounts and sign-in

These calls are made on your own domain, never on app.dwalliance.com. Codes are only ever sent by email.

  1. New customer: POST {"action":"request_code","email":"..."} to /end_user_account_setup/. A 6-character code is emailed and lasts 30 minutes.
  2. POST {"action":"verify","id":"...","confirmation_id":"..."}. The customer is now signed in for 30 days on that domain.
  3. Then {"action":"profile",...} adds their name, company name, phone, and shipping or billing address.
  4. Returning customer: POST {"action":"request_code","email":"..."} to /customer_session/, then verify with the returned id and the emailed code. whoami and logout are also available.

Sign-up is US-only, blocks VPN and Tor traffic, and is rate limited. Unfinished sign-ups are deleted after 90 days.

Customer addresses

/address/ creates, edits, lists and deletes addresses. A signed-in customer manages their own; staff can manage people and companies on their brand. Checkout uses one shipping address and one billing address from this list.

POST /address/  {"action":"create","line_1":"75-5660 Palani Rd","city":"Kailua-Kona","state":"HI","zipcode":"96740","address_type":"Shipping"}

Carts

Checkout and invoices

POST /store/checkout/
{"action":"checkout","cart_id":"...","shipping_address_id":"...","billing_address_id":"..."}

Payments

Online card and PayPal processing is not connected yet. A customer's CARD or PAYPAL request is recorded as PENDING and no charge is made; the store confirms the payment (for example after an invoice is paid by phone or in person) by marking it COMPLETED.

Shipments

History and safety

Endpoint reference

POST JSON with an action. A GET (or a POST with no action) on any path returns its list of actions. Staff add session and brand to the body.

PathActionsWho
/store/products/list, readPublic
/store/products/categories/listPublic
/store/search/search (q)Public
/store/product/create, update, delete, claim, unclaimStaff
/store/product/variants/list (public), create, update, deleteStaff
/store/product/description/create, update, deleteStaff
/store/product/categories/create, update, delete, link, unlinkStaff
/store/product/images/create, update, deleteStaff
/store/cart/add, update, remove, read, mine, deletePublic / customer
/store/checkout/checkoutCustomer
/store/invoice/read, list, updateCustomer (own) / staff
/store/invoice/payment/create, update, listCustomer (own) / staff
/store/shipment/create, update, delete, read, listStaff / customer (read)
/address/create, update, delete, read, listCustomer (own) / staff
/end_user_account_setup/request_code, verify, status, profileCustomer, on your domain
/customer_session/request_code, verify, whoami, logoutCustomer, on your domain

Always include the trailing slash, for example /store/cart/. Errors come back as {"ok":false,"error":"..."} with a matching HTTP status.