Skip to main content

Phase 8 — Ledger

The financial bookkeeping flow. RideNDine is the financial source of truth — COOCO only receives data for reconciliation and does not perform its own calculations.


Overview

Stripe → RideNDine (internal ledger) → COOCO (webhook / GET) → Admin UI
StepFromToAction
8.1StripeRideNDineFunds captured confirmation
8.2RideNDineRideNDineInternal ledger entry
8.3RideNDineCOOCOPOST /webhooks/ledger-entry or GET /orders/{id}/ledger
8.4COOCO AdminCOOCOInternal — reconciliation UI

Step 8.1 — Stripe Confirms Funds (RideNDine)

Stripe confirms that funds have entered the RideNDine account. COOCO is not involved at this step.


Step 8.2 — Internal Bookkeeping (RideNDine)

RideNDine records the ledger entry:

gross - delivery_fee - service_fee - tax - platform_fee = chef_net

COOCO does not calculate this itself. RideNDine is the financial source of truth.


Step 8.3 — Receive Ledger Data

From: RideNDine → To: COOCO

There are 2 ways COOCO can receive ledger data:

Option 1 — Webhook (Push)

Endpoint (COOCO expose): {DIRECTUS_URL}/ridendine/webhooks/ledger-entry

Method: POST

{
"ridendine_order_id": "<string>",
"external_order_id": "<orders.id>",
"gross_cents": 5000,
"delivery_fee_cents": 300,
"service_fee_cents": 200,
"tax_cents": 400,
"platform_fee_cents": 150,
"tip_cents": 100,
"chef_net_cents": 3850
}

Option 2 — On-demand (Pull)

COOCO calls GET /orders/{ridendine_order_id}/ledger when the Admin opens the order detail view.

Save to Directus

Save the full breakdown to orders.ledger_snapshot (JSON field).


Step 8.4 — Reconciliation UI (Internal)

From: COOCO Admin → To: COOCO

cooco-admin reads orders.ledger_snapshot to display the financial breakdown.

No requests are sent to RideNDine at this step.