Selling cash on delivery
Customers
One record per person who ordered, with their delivery history, a reliability score, consent for WhatsApp, and the merchant's saved segments.
One customer per phone
Every order is matched to a customer by phone (or email when there is no phone). The customer record keeps the counts the merchant looks at before confirming a cash-on-delivery order: orders_count, delivered_count, returned_count, cancelled_count, total_spent.
Look one up by phone with GET /v1/customers?phone=0551234567, and list their orders with GET /v1/orders?customer_id=cus_….
Reliability
reliability is the customer's delivery score: how likely they are to accept a COD parcel. score is a percentage built from their finished orders: delivered counts for them, returned against them, cancelled half against them. Orders at other Ordexs stores count at half weight, and an order's weight halves every 180 days, so recent behaviour matters most.
tier | score | Means |
|---|---|---|
reliable | 75–100 | Usually accepts the parcel. |
uncertain | 50–74 | Accepts some, refuses or returns others. |
risky | 0–49 | Often refuses or returns. Worth a confirmation call before shipping. |
new | null | No delivered, returned or cancelled order yet. |
It is the same score the dashboard shows on customers and order cards, recalculated as orders are delivered or returned.
Blocking and follow-up
PATCH /v1/customers/{id} with status:
needs_followupflags the customer for the team;do_not_contactblocks them, like Block on the Customers page;activelifts either.
WhatsApp consent
whatsapp_opt_in records whether the customer agreed to receive WhatsApp messages, and whatsapp_opt_in_at when. Set it with PATCH /v1/customers/{id} only when the customer actually agreed.
Segments
The merchant saves segments on the Customers page (reliable buyers, customers who haven't ordered in 60 days, one wilaya…). GET /v1/customer_segments lists them with their current size, and GET /v1/customer_segments/{id}/customers lists who is in one right now. A segment is a saved filter: its members change as customers do.
