Built-in flows
The flow seeded for each commerce model, how seeding works, and the dashboard scenarios that exercise them.
OrderLoop seeds at least one flow per commerce model. Each is an ordinary flow: open it in the editor, change it and publish a new version.
Seeding
Section titled “Seeding”OrderLoop publishes the built-in flows the first time they are needed: when flows are listed or opened, when an order starts, and before the stock review starts a replenishment order. When a built-in flow changes in a new OrderLoop release, the new version is published over the flow’s draft and over anything you published from the editor since, so keep a customised copy as its own flow. A built-in flow that matches an earlier version is never published again, and orders already running keep the version they pinned.
The flows
Section titled “The flows”Purchase request
tpl-purchase-requestInternal procurement: AI spend classification, budget check, tiered approvals, PO, supplier acknowledgement, goods receipt, 3-way match and payment.
- ModelProcurement
- ChannelsDashboard, Email, API
- Nodes22
- Edges30
Nodes
| Id | Label | Type |
|---|---|---|
request | Purchase request | Manual / API |
classify | Classify spend | Classify |
price | Price lines | Price lines |
budget | Budget check | Budget check |
needs_mgr | Over $5k? | Condition |
mgr | Manager approval | Approval |
needs_fin | Over $20k? | Condition |
fin | Finance approval | Approval |
po | Generate PO | Generate PO |
send | Send PO to supplier | Notify |
ack | Supplier acknowledges | Wait for event |
goods | Goods received | Wait for event |
match | 3-way match | 3-way match |
mismatch | Resolve mismatch | Approval |
pay | Pay supplier | Pay supplier |
erp | Post to ERP | ERP sync |
done | Closed | End |
reject_note | Tell requester | Notify |
rejected | Rejected | End |
expire_note | Tell requester | Notify |
expired | No decision | End |
stalled | Supplier unresponsive | End |
B2B order
tpl-b2b-orderInbound PO by email: AI extraction, contract pricing, credit check, an assessment that fast-tracks confidently routine orders, an agent that triages the rest to auto-approve / approval / clarify, stock reservation, net-30 invoice, shipment and a dunning loop.
- ModelB2B
- ChannelsEmail, EDI, API, Dashboard
- Nodes29
- Edges35
Nodes
| Id | Label | Type |
|---|---|---|
po_in | PO received | Inbound email |
extract | Extract order | Extract order |
validate | Validate | Validate order |
price | Contract pricing | Price lines |
tax | Tax | Calculate tax |
credit | Credit check | Credit check |
assess | Assess: routine? | Assess |
router | Agent: triage | Agent router |
clarify | Ask customer | Notify |
reply | Customer replies | Wait for event |
approval | Sales approval | Approval |
reserve | Reserve stock | Reserve inventory |
invoice | Invoice | Generate invoice |
ship | Ship | Create shipment |
erp | Post to ERP | ERP sync |
paid | Payment received | Wait for event |
dunning | Dunning | Loop |
remind | Payment reminder | Notify |
paid_late | Payment received | Wait for event |
collections | Send to collections | Notify |
done | Paid | End |
unpaid | Unpaid | End |
decline | Decline order | Notify |
declined | Declined | End |
expire | Decline order | Notify |
expired | No decision | End |
unanswered | Decline order | Notify |
no_reply | No reply | End |
backorder | Out of stock | End |
Reorder
tpl-reorderScheduled replenishment: AI demand forecast for SKUs at their reorder point, PO generation, approval above $10k, supplier acknowledgement, receipt and restock.
- ModelReplenishment
- ChannelsSchedule, Dashboard
- Nodes16
- Edges18
Nodes
| Id | Label | Type |
|---|---|---|
schedule | Daily stock review | Schedule |
forecast | Forecast demand | Demand forecast |
any | Anything to order? | Condition |
price | Supplier cost | Price lines |
po | Replenishment PO | Generate PO |
big | Over $10k? | Condition |
approval | Buyer approval | Approval |
submit | Submit to supplier | Notify |
ack | Supplier acknowledges | Wait for event |
receipt | Goods received | Wait for event |
restock | Restock | Restock |
erp | Post to ERP | ERP sync |
done | Restocked | End |
nothing | Nothing to order | End |
skip | Not approved | End |
late | Supplier late | End |
Subscription
tpl-subscriptionRecurring box subscription: authorize, then a billing-period loop (wait → charge → ship) with a dunning retry, continuing as a new run after 12 cycles.
- ModelSubscription
- ChannelsWeb, Mobile app, API
- Nodes18
- Edges19
Nodes
| Id | Label | Type |
|---|---|---|
signup | Subscription signup | Webhook |
validate | Validate | Validate order |
price | Plan price | Price lines |
tax | Tax | Calculate tax |
authorize | Authorize card | Authorize payment |
welcome | Welcome email | Notify |
init | Start year | Set variables |
periods | Billing periods | Loop |
renewal | Until renewal | Wait |
charge | Charge renewal | Charge |
retry_wait | Dunning delay | Wait |
retry | Retry charge | Charge |
fulfill | Ship box | Create shipment |
next | Next cycle | Set variables |
pause | Payment failed | Notify |
paused | Paused | End |
renew | Next year | Continue as new |
declined | Card declined | End |
Storefront order
tpl-storefront-orderCard checkout: store policy, authorize, reserve, ship and capture, then a 30-day return window: RMA label, goods received, restock and a full or partial refund.
- ModelB2C retail
- ChannelsWeb, Mobile app, API
- Nodes26
- Edges26
Nodes
| Id | Label | Type |
|---|---|---|
checkout | Storefront checkout | Webhook |
validate | Validate | Validate order |
price | List price | Price lines |
tax | Tax | Calculate tax |
policy | Store policy | Policy check |
reject | Explain rejection | Notify |
rejected | Rejected | End |
authorize | Authorize card | Authorize payment |
reserve | Reserve stock | Reserve inventory |
ship | Ship | Create shipment |
capture | Capture payment | Capture payment |
shipped | Shipping confirmation | Notify |
window | Return window | Wait for event |
rma | Return label | Return label |
send_label | Send return label | Notify |
back | Return received | Wait for event |
restock | Restock | Restock |
refund | Refund | Refund |
refunded | Refund confirmation | Notify |
review | Refund needs review | Notify |
done | Fulfilled | End |
returned | Returned | End |
lost | Return not received | End |
declined | Card declined | End |
short | Out of stock | End |
uncaptured | Capture failed | End |
Marketplace order
tpl-marketplace-orderMulti-seller checkout: fraud check, authorize, split by seller and wait for each seller to accept, ship and capture what was accepted, a return window, then seller payouts net of commission and refunds.
- ModelMarketplace
- ChannelsMarketplace, Web, Mobile app, API
- Nodes30
- Edges40
Nodes
| Id | Label | Type |
|---|---|---|
checkout | Marketplace checkout | Webhook |
validate | Validate | Validate order |
price | List price | Price lines |
tax | Tax | Calculate tax |
risk | Fraud check | Risk score |
trust | Trust & safety review | Approval |
authorize | Authorize card | Authorize payment |
split | Split by seller | Split by seller |
ask | Ask sellers | Notify |
accepting | Seller responses | Loop |
responded | Seller responds | Wait for event |
record | Record response | Seller response |
expire | Reject unanswered | Seller response |
reserve | Reserve stock | Reserve inventory |
ship | Ship | Create shipment |
capture | Capture payment | Capture payment |
shipped | Shipping confirmation | Notify |
window | Return window | Wait for event |
rma | Return label | Return label |
back | Return received | Wait for event |
restock | Restock | Restock |
refund | Refund | Refund |
payout | Seller payouts | Seller payouts |
done | Fulfilled | End |
blocked | Blocked | End |
declined | Card declined | End |
no_sellers | No seller accepted | End |
unanswered | Sellers did not answer | End |
short | Out of stock | End |
uncaptured | Capture failed | End |
Omnichannel order
tpl-omnichannel-orderA brand’s own store: authorize, then route each order to shipping (from the warehouse or a store), pickup in store with a code, or digital delivery, and capture once every part is fulfilled.
- ModelDirect to consumer
- ChannelsWeb, Mobile app, API
- Nodes23
- Edges26
Nodes
| Id | Label | Type |
|---|---|---|
checkout | Checkout | Webhook |
validate | Validate | Validate order |
price | List price | Price lines |
tax | Tax | Calculate tax |
authorize | Authorize payment | Authorize payment |
route | Route fulfillment | Route fulfillment |
reserve_ship | Reserve stock | Reserve inventory |
ship | Ship | Create shipment |
shipped | Shipping confirmation | Notify |
reserve_pickup | Hold at store | Reserve inventory |
ready | Ready for pickup | Ready for pickup |
ready_note | Pickup ready | Notify |
collect | Customer collects | Wait for event |
handover | Hand over | Hand over |
deliver | Deliver digital goods | Deliver digital goods |
delivered | Download ready | Notify |
capture | Capture payment | Capture payment |
done | Fulfilled | End |
declined | Payment declined | End |
unavailable | Cannot fulfil | End |
short | Out of stock | End |
uncollected | Not collected | End |
uncaptured | Capture failed | End |
Point-of-sale sale
tpl-pos-saleA sale at the till: take payment, hand the goods over from the store’s own stock (or issue gift card and download codes), capture, and email a receipt when the buyer gives an address.
- ModelB2C retail
- ChannelsPoint of sale
- Nodes16
- Edges18
Nodes
| Id | Label | Type |
|---|---|---|
sale | Till sale | Webhook |
validate | Validate | Validate order |
price | List price | Price lines |
tax | Tax | Calculate tax |
authorize | Take payment | Authorize payment |
route | Store stock | Route fulfillment |
reserve | Take from store stock | Reserve inventory |
handover | Hand over | Hand over |
deliver | Issue codes | Deliver digital goods |
capture | Capture payment | Capture payment |
has_email | Email receipt? | Condition |
receipt | Email receipt | Notify |
done | Sold | End |
declined | Payment declined | End |
unavailable | Not in stock here | End |
uncaptured | Capture failed | End |
tpl-marketplace-order is the marketplace model’s flow; Marketplace walks through it.
tpl-omnichannel-order is the d2c default and tpl-pos-sale the flow for pos till sales; Fulfillment walks through them.
Scenarios
Section titled “Scenarios”In workspaces with the demo data loaded, the dashboard’s Demo scenarios start an order on a built-in flow with a canned input. Each exercises a different path:
| Scenario | Flow | Path |
|---|---|---|
| Guest checkout | tpl-storefront-order |
A b2c web order with contact and no customer: card checkout, and the shipping and return emails go to the contact address |
| B2B PO by email | tpl-b2b-order |
AI extracts lines from an email, contract pricing, the credit check passes, the routine assessment is unsure (without the model it always answers 0.5), so the agent router triages and auto-approves; ships, waits for payment |
| B2B over credit limit | tpl-b2b-order |
cus_contoso is near its limit, so the credit check routes to a person |
| B2B out of stock | tpl-b2b-order |
meta.simulate: "out_of_stock": the reservation comes up short and the order fails and rolls back |
| Procurement request | tpl-purchase-request |
Eight laptops: AI classifies spend, manager then finance approve, PO, supplier ack, 3-way match |
| Reorder (stock review) | tpl-reorder |
The forecast finds SKUs below their reorder point and drafts a replenishment PO |
| Subscription | tpl-subscription |
Authorize, then a loop of wait → charge → ship |
| Subscription, card fails | tpl-subscription |
meta.simulate: "charge_fail": the renewal and its retry both fail and the subscription pauses |
| Storefront order in euros | tpl-storefront-order |
The retail checkout in EUR: USD prices convert at the workspace’s stored EUR rate, and the order, capture and webhooks are in euros |
| Marketplace order, two sellers | tpl-marketplace-order |
HP-200 from a seller that auto-accepts and KET-01 from one that is asked: the order waits for Kettle & Co, then ships what was accepted and schedules each seller’s payout net of commission. See Marketplace |
| Buy online, pick up in store | tpl-omnichannel-order |
A monitor held at the SoHo store with a pickup code; the order waits for pickup.collected, then hands it over and captures payment |
| Ship from store, with an e-book | tpl-omnichannel-order |
The warehouse has no tees, so they ship from the SoHo store, the nearest to the New York ship-to (which carries coordinates); the e-book is delivered as a code, and payment is captured once both parts are done |
| Split shipment, nearest store | tpl-omnichannel-order |
Eight monitors and three tees to San Francisco: no one place has both, so the monitors ship from the warehouse and the tees from the Mission store, as two shipments |
| Till sale with a gift card | tpl-pos-sale |
A tee and a gift card at the Mission store: card present, the tee leaves store stock, the gift card gets a code, and the receipt is emailed |
| Storefront order, returned | tpl-storefront-order |
Ships and captures, then a return: RMA label, restock, refund. A return.requested payload with lines: [{ sku, qty }] restocks only those lines; amount sets a partial refund |
Simulating failures
Section titled “Simulating failures”The built-in commerce steps read order.meta.simulate, so any order (from the API too) can take a
failure path:
| Value | Effect |
|---|---|
out_of_stock |
Reserve inventory reports every line short |
payment_decline |
Authorize payment takes declined |
charge_fail |
Charge takes failed |
three_way_mismatch |
3-way match sees an invoice 10% over the PO and takes mismatch |
Restarting an order from its page drops meta.simulate, so the retry runs for real.
Stock review
Section titled “Stock review”The stock review runs daily at 06:00 UTC. It scans for
SKUs at or below their reorder point and, if there are any, starts one order on tpl-reorder
titled Replenish <skus>. Run stock review now on the back office page starts it on demand.