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)
| Step | From | To | Action |
|---|---|---|---|
| 1.1 | Chef | COOCO | Internal β store setup / menu / pricing |
| 1.2 | COOCO | RideNDine | POST /merchants/sync |
| 1.3 | RideNDine | COOCO | POST /webhooks/merchant-status |
| 1.4 | COOCO | COOCO | Internal 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:
| Collection | Fields |
|---|---|
stores | displayName, displayAddress, phone, bank_info, deliveryFeeCents |
store_details | deliveryRegion (lat/lng), isActive |
products | menu 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"
}
Headerβ
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:
| Condition | Field / Collection |
|---|---|
| Chef has been approved | chef_profiles.onboarding_status = approved |
| Store is active | store_details.isActive = true |
| Merchant is active on RideNDine | stores.ridendine_merchant_status = ACTIVE |
| At least 1 product exists | products.isVisible = true (at least 1 item) |
No requests are sent to RideNDine at this step.