Process
Carts, orders, payments and subscriptions.
Process (DropCoreProcess)#
src/process/drop_core_process.ts
Resolved via getDropCoreProcess(session?) or getDropCoreInstance().process.
All routes hit process/**.
cart: CartProcess#
Server-side storefront carts (store/{sid}/carts/{cartId}) — inert
pre-order docs (no triggers/hooks/stock) that expire via a Firestore TTL
policy. Check out with order.make({cart: id}), which uses the cart as the
request base and deletes it on success.
| method |
endpoint |
notes |
set(items?, opts?) |
process/cart/set |
Upsert; omit opts.id to create (returned cart carries the id). items replaces wholesale; every set refreshes the TTL stamp. |
get(id) |
process/cart/get |
404 rejection when missing/expired. |
delete(id) |
process/cart/delete |
Idempotent. |
order: OrderProcess#
| method |
endpoint |
notes |
make(order: OrderInitEntity) |
process/order/make |
Create / draft an order. With cart: <cartId> the cart's items/promo/locale/origin/note/uid become the base (explicit fields win) and the cart is deleted after success — a denied order keeps it (missing cart → 404). |
update(oid, order) |
process/order/update |
Replace an existing order's items; oid is sent as order. Staff tokens only (403 staff_only); an unknown order is 404 order_not_found. |
finalize(oid, order) |
process/order/make |
Re-uses make with finalize: true; defaults status to OrderStatus.open. Staff tokens only (master, or owner/editor whose scope writes orders) — any other caller gets 403 order_field_forbidden; the same holds for payment: 'personal' (400 payment_method_unavailable), a status other than cart/open and number on make (see functions/docs/api.md "Buyers and staff"). |
cancel(oid, reason?) |
process/order/cancel |
reason is included only when defined. Staff on any existing order; an identity token only on its own unpaid order up to confirmed; other tokens 403 staff_only (functions/docs/api.md "Buyers and staff"). |
payment: PaymentProcess#
| method |
endpoint |
notes |
init(payment) |
process/payment/init |
Initialize a payment session. |
preview(uid, type?) |
process/payment/preview |
type ∈ 'cards' | 'intent' | 'all'. |
detach(uid, method) |
process/payment/detach |
Detach a saved payment method. |
subscription: SubscriptionProcess#
| method |
endpoint |
notes |
cancel({sub?, order?}, atPeriodEnd?) |
process/subscription/cancel |
Cancel a subscription — by its Stripe id (sub) or by the order that created it (order). With atPeriodEnd it stays active until the current period ends and Stripe then cancels it. Staff, or an identity token on its own subscription; other tokens 403 staff_only. |