Rabbinatix
Sign inGet started
Store

Place an order

FreeFlow
@rabbinatix/place-an-order by Rabbinatixupdated Oct 13, 2026

A shopper buys a product; the order service checks stock, charges the card through a payment provider and saves the order.

Sign up to use it

Checkout from "Buy" to a paid order:

  • Client app sends the product, quantity and card token, and shows the answer.
  • Order service checks the quantity, finds the product, refuses when stock is short, charges the total and saves the order.
  • Shop database answers the product lookup and keeps the orders. Payment provider charges the card. Event bus (optional) receives order.placed.

The card is charged only after the stock check, and the order is saved only when the payment is accepted.

The unhappy paths are in: a declined card (402), a card that needs 3-D Secure (202 with the bank’s page; the order waits as awaiting_payment), a payment provider that doesn’t answer in time (504, safe to retry), and the same order sent twice, which gets the first order back (200) instead of a second charge. The idempotency key goes to the payment provider too, so a retry after a timeout never charges twice.

Previewlanes are roles; you pick your systems when importing
Not foundNot found200202400402404409504Other
Start in Client app. step 1 of 32. key stepOn Confirm purchase
Call to another system in Client app. step 2 of 32. key stepCall place order
Start in Order service. step 3 of 32. key stepOn POST /api/v1/orders
Resource in Order service. step 4 of 32Placed already? (same idempotency key)
Answer in Shop database. step 5 of 32. key steporders.findByIdempotencyKey
Return in Order service. step 6 of 32. key stepSame order again → 200, not charged twice
Resource in Order service. step 7 of 32. key stepFind product
Answer in Shop database. step 8 of 32. key stepproducts.findById
Return in Order service. step 9 of 32. key stepOut of stock → 409
Resource in Order service. step 10 of 32. key stepCharge the card
Answer in Payment provider. step 11 of 32. key steppayments.charge
Resource in Order service. step 12 of 32. key stepSave the order
Answer in Shop database. step 13 of 32. key steporders.insert
Resource in Order service. step 14 of 32Publish order.placed
Answer in Event bus. step 15 of 32. key steporder.placed
Return in Order service. step 16 of 32. key stepReturn 201
Resource in Order service. step 17 of 32Save it, waiting for the bank
Answer in Shop database. step 18 of 32. key steporders.insert
Return in Order service. step 19 of 32. key step3-D Secure → 202 with the bank’s page
Return in Order service. step 20 of 32. key stepProvider too slow → 504, safe to retry
Return in Order service. step 21 of 32. key stepPayment declined → 402
Return in Order service. step 22 of 32. key stepUnknown product → 404
Return in Order service. step 23 of 32. key stepBad quantity → 400
Return in Client app. step 24 of 32. key stepReturn
Return in Client app. step 25 of 32. key stepReturn
Return in Client app. step 26 of 32. key stepReturn
Return in Client app. step 27 of 32. key stepReturn
Return in Client app. step 28 of 32. key stepReturn
Return in Client app. step 29 of 32. key stepReturn
Return in Client app. step 30 of 32. key stepReturn
Return in Client app. step 31 of 32. key stepReturn
Return in Client app. step 32 of 32. key stepReturn
Client app
Web frontend
Order service
Backend service
Shop database
Database
Payment provider
External API
Event bus
Queue / event bus

Up and down arrows: previous or next step. Home, End: first or last. Enter: select. Shift F10: more actions.

APIs
POST{base}/orders· Place an order
Order service provides it · Client app calls it
Request body
productId: string
quantity: integer
cardToken: string
idempotencyKey: string
201
id: string
total: number
200
id: string
total: number
202
id: string
actionUrl: string
400
error: string
402
error: string
404
error: string
409
error: string
504
error: string
Data operations
products.findByIdqueryon Shop database(productId: string)
orders.findByIdempotencyKeyqueryon Shop database(idempotencyKey: string)
orders.insertinserton Shop database(productId: string, quantity: integer, total: number, chargeId: string, status: string, idempotencyKey: string)
payments.chargecallon Payment provider(amount: number, cardToken: string, idempotencyKey: string)
order.placedpublishon Event bus(orderId: string, total: number)
Test cases
Order placed→ Order placed
Same order sent twice→ The first order comes back
Card needs 3-D Secure→ Waiting for the bank
Payment provider times out→ Try again, not charged twice
Quantity zero→ Quantity not allowed
Unknown product→ Product not found
More than in stock→ Not enough stock
Card declined→ Payment declined
Order publishes order.placed→ Order placedwith “Publish order.placed”
Requirements
Never sell more than is in stock, and check before charging the card.
Save an order only when the payment is accepted, or as awaiting payment while the bank confirms it.
Never charge the same order twice: a repeat or a retry after a timeout uses the same idempotency key.
The quantity is between 1 and the allowed maximum.
Roles (5)
Client app
Where the shopper confirms the purchase · Web frontend or mobile app
Order service
Checks stock, takes the payment and saves the order · Backend service
Shop database
Products, stock and orders · Database
Payment provider
Charges the card · External API or backend service
Event bus (optional)
Receives order.placed (optional) · Queue / event bus
Settings
Most items per order10
Publish order.placedon
Product id fieldproductId (renamable)

Also as a whiteboard

Versions