Phase 10 β Refunds
The refund flow. COOCO initiates the refund request, RideNDine processes it via Stripe, and sends the result back via webhook.
Overviewβ
Customer / Admin β COOCO β RideNDine β Stripe
β (webhook)
COOCO (update + notify)
| Step | From | To | Action |
|---|---|---|---|
| 10.1 | Customer / Admin | COOCO | Internal β refund request |
| 10.2 | COOCO | RideNDine | POST /refunds/create |
| 10.3 | RideNDine | Stripe | Process refund |
| 10.4 | Stripe | RideNDine | Stripe refund webhook |
| 10.5 | RideNDine | COOCO | POST /webhooks/refund-status |
| 10.6 | COOCO | Customer + Chef + Admin | Internal notification |
Step 10.1 β Refund Request (Internal)β
From: Customer / Admin β To: COOCO
COOCO collects refund information:
| Field | Description |
|---|---|
order_id | ID of the order to be refunded |
reason | chef_rejected / customer_cancel |
amount_cents | Refund amount (full or partial) |
requested_by | customer / admin |
Step 10.2 β Send Refund Request to RideNDineβ
From: COOCO β To: RideNDine
Endpoint: POST /refunds/create
Called via Directus Extension: POST /ridendine/refunds.
Purpose: RideNDine processes the refund via Stripe.
Request Bodyβ
{
"ridendine_order_id": "<orders.ridendine_order_id>",
"external_order_id": "<orders.id>",
"amount_cents": 5000,
"reason": "chef_rejected | customer_cancel",
"requested_by": "customer | admin"
}
Step 10.3 β Stripe Process Refund (RideNDine Internal)β
RideNDine creates a refund request on Stripe. COOCO is not involved at this step.
Step 10.4 β Stripe Refund Webhook (RideNDine Internal)β
Stripe calls the RideNDine webhook to confirm the refund. COOCO is not involved at this step.
Step 10.5 β Webhook: Refund Statusβ
From: RideNDine β To: COOCO
Endpoint (COOCO expose): {DIRECTUS_URL}/ridendine/webhooks/refund-status
Method: POST
Purpose: COOCO updates the refund status.
Payload receivedβ
{
"refund_id": "<string>",
"external_order_id": "<orders.id>",
"amount_cents": 5000,
"status": "REFUNDED | FAILED"
}
Handling when REFUNDEDβ
| Field | Value |
|---|---|
orders.payment_status | REFUNDED |
orders.status | CANCELLED |
Step 10.6 β Result Notification (Internal)β
From: COOCO β To: Customer + Chef + Admin
Directus Flow sends an email notification with the refund result to all relevant parties.
No requests are sent to RideNDine at this step.