Skip to main content

Phase 3 — Order Creation

The order creation flow after the customer confirms checkout. COOCO is the central order hub — it creates an internal record first, then synchronizes to RideNDine.


Overview

Customer → COOCO (internal) → RideNDine → COOCO (link IDs)
StepFromToAction
3.1CustomerCOOCOInternal — confirm checkout
3.2COOCOCOOCOInternal — create order record
3.3COOCORideNDinePOST /orders/create
3.4RideNDineCOOCOResponse POST /orders/create

Step 3.1 — Confirm Checkout (Internal)

From: Customer → To: COOCO

Purpose: Begin order creation.

COOCO collects:

FieldDescription
quote_idQuote ID retrieved in Phase 2
fulfillment_methodDELIVERY or PICKUP
shipping_snapshotSnapshotted delivery address
customer_noteCustomer note
idempotency_keyUUID — prevents double-click

Step 3.2 — Create Order Record (Internal)

From: COOCO → To: COOCO

Purpose: COOCO is the central order hub.

Creates a record on Directus orders:

FieldValue
statusPENDING_PAYMENT
payment_statusPENDING
quote_idfrom Step 3.1
totalsfrom quote response
shipping_snapshotaddress snapshot
items_snapshotcart snapshot
idempotency_keyUUID

Also creates order_items.

info

The chef is not yet notified to cook at this step.


Step 3.3 — Create Order on RideNDine

From: COOCO → To: RideNDine

Endpoint: POST /orders/create

Purpose: RideNDine creates the order to handle payment + coordinate delivery.

Request Body

{
"quote_id": "<quote_id>",
"external_order_id": "<orders.id>",
"merchant_id": "<stores.ridendine_merchant_id>",
"customer": {
"external_id": "<customer.id>",
"name": "<customer.name>",
"phone": "<customer.phone>",
"email": "<customer.email>"
},
"fulfillment": {
"type": "DELIVERY | PICKUP",
"address": "<shipping_snapshot.address>",
"lat": "<lat>",
"lng": "<lng>"
},
"items": [],
"totals": {}
}
Idempotency-Key: cooco_order_{orders.id}

From: RideNDine → To: COOCO

Purpose: Link the 2 systems + prepare for payment.

Response

{
"ridendine_order_id": "<string>",
"payment_session_id": "<string>"
}

Save to Directus

  • orders.ridendine_order_id
  • orders.payment_session_id