Skip to main content

Phase 2 — Cart & Quote

The flow where a customer adds items to the cart and retrieves a quote from RideNDine. RideNDine is the source of truth for all fees — COOCO does not calculate them independently.


Overview

Customer → COOCO → RideNDine → COOCO → Customer
StepFromToAction
2.1CustomerCOOCOInternal — add to cart
2.2COOCORideNDinePOST /checkout/quote
2.3RideNDineRideNDineInternal pricing logic
2.4RideNDineCOOCOResponse POST /checkout/quote
2.5COOCOCustomerInternal — display checkout total

Step 2.1 — Add to Cart (Internal)

From: Customer → To: COOCO

Purpose: COOCO maintains cart state.

COOCO collects and prepares the following payload, then calls Directus Extension POST /ridendine/quote:

{
"merchant_id": "<stores.ridendine_merchant_id>",
"subtotal_cents": "<carts.subtotal_cents>",
"pickup": {
"lat": "<store lat>",
"lng": "<store lng>"
},
"delivery": {
"lat": "<customer lat>",
"lng": "<customer lng>",
"address": "<shipping_snapshot.address>"
},
"tip_cents": "<tip>",
"items": []
}

Step 2.2 — Get Quote from RideNDine

From: COOCO → To: RideNDine

Endpoint: POST /checkout/quote

Purpose: RideNDine calculates delivery_fee + service_fee + tax + tip.

COOCO does not calculate any fees independently. All pricing logic belongs to RideNDine.


Step 2.3 — Pricing Engine (RideNDine Internal)

From: RideNDine → To: RideNDine

RideNDine runs its internal pricing engine. COOCO does not participate in this step.


Step 2.4 — Receive Quote Response

From: RideNDine → To: COOCO

COOCO receives and stores the complete price breakdown:

FieldDescription
quote_idQuote identifier (used for order creation)
subtotal_centsCart value
delivery_fee_centsDelivery fee
service_fee_centsService fee
tax_centsTax
tip_centsTip amount
total_centsGrand total
expires_atQuote expiration time

COOCO saves this to the checkout state or the ridendine_quotes collection.


Step 2.5 — Display Total (Internal)

From: COOCO → To: Customer

COOCO displays the breakdown from the quote response to the customer before confirmation.

caution

COOCO MUST NOT calculate tax 8% + deliveryFeeCents locally. All figures must be taken from the RideNDine quote response.