Skip to main content

Phase 1 β€” Merchant Setup

The merchant initialization flow on the COOCO system and synchronization to RideNDine. COOCO is the source of truth for merchant information.


Overview​

Chef β†’ COOCO β†’ RideNDine β†’ COOCO (webhook)
StepFromToAction
1.1ChefCOOCOInternal β€” store setup / menu / pricing
1.2COOCORideNDinePOST /merchants/sync
1.3RideNDineCOOCOPOST /webhooks/merchant-status
1.4COOCOCOOCOInternal compliance check

Step 1.1 β€” Store Setup (Internal)​

From: Chef β†’ To: COOCO

Purpose: COOCO is the source of truth for merchant data.

COOCO stores on Directus:

CollectionFields
storesdisplayName, displayAddress, phone, bank_info, deliveryFeeCents
store_detailsdeliveryRegion (lat/lng), isActive
productsmenu items

No data is sent to RideNDine at this step.


Step 1.2 β€” Sync Merchant to RideNDine​

From: COOCO β†’ To: RideNDine

Endpoint: POST /merchants/sync

Purpose: RideNDine knows the merchant for fee calculation, payout, and compliance.

Request Body​

{
"external_merchant_id": "<stores.id>",
"name": "<displayName>",
"address": {
"lat": "<lat>",
"lng": "<lng>"
},
"phone": "<phone>",
"bank_account": "<bank_info>",
"compliance_status": "APPROVED"
}
Idempotency-Key: merchant_sync_{store_id}

Side Effect​

Saves stores.ridendine_sync_status = PENDING.


Step 1.3 β€” Webhook: Merchant Status from RideNDine​

From: RideNDine β†’ To: COOCO

Endpoint (COOCO expose): {DIRECTUS_URL}/ridendine/webhooks/merchant-status

Method: POST

Purpose: RideNDine notifies merchant ACTIVE / compliance issues.

Received Payload​

{
"event_id": "<uuid>",
"ridendine_merchant_id": "<string>",
"status": "ACTIVE | INACTIVE | REJECTED"
}

Processing​

  • Save stores.ridendine_merchant_id
  • Save stores.ridendine_merchant_status
  • Verify webhook signature before processing.

Step 1.4 β€” Compliance Check (Internal)​

From: COOCO β†’ To: COOCO

Purpose: No Approval β†’ No Sales β€” block sales if conditions are not met.

COOCO internally checks all of the following conditions:

ConditionField / Collection
Chef has been approvedchef_profiles.onboarding_status = approved
Store is activestore_details.isActive = true
Merchant is active on RideNDinestores.ridendine_merchant_status = ACTIVE
At least 1 product existsproducts.isVisible = true (at least 1 item)

No requests are sent to RideNDine at this step.