Selling cash on delivery
Delivery setup
How the store prices delivery and which courier ships, the store's own prices per region, the default courier and routing rules.
Strategy
GET /v1/delivery/settings shows how delivery is priced at checkout and who ships. strategy is the one switch:
strategy | Prices | Who ships |
|---|---|---|
flat | The store's own prices per region (/v1/delivery/prices). | The routing rules, then the default courier. |
customer_choice | Live rates of the couriers in courier_ids. | The courier the shopper picked. |
cheapest | Live rates of courier_ids, cheapest shown. | That courier. |
modes turns door delivery (home) and pickup points on or off, labels names them at checkout, and fallback_to_flat_prices uses the store's prices where a courier has no rate for a region.
curl -X PATCH https://api.ordexs.com/v1/delivery/settings \
-H "Authorization: Bearer $ORDEXS_KEY" -H "Content-Type: application/json" \
-d '{"strategy":"flat","modes":{"home":true,"pickup_point":false}}'GET /v1/couriers lists the store's courier accounts. Connecting one (its keys) is done in the dashboard; the API uses the accounts that exist. default_courier_id in the settings sets the default (null clears it).
Prices per region
GET /v1/delivery/prices lists every region with its door-delivery and pickup-point price. PATCH sets the regions you send and leaves the rest:
{ "prices": [ { "region": "16", "home": "500.00", "pickup_point": "300.00" }, { "region": "31", "home": "700.00" } ] }"0.00" is free delivery. GET /v1/delivery/rates?region=16 shows what checkout charges once the change is saved.
Routing rules
With the flat strategy, Ordexs picks the courier for each order: a product rule first, then a region rule, then a weight rule, else the default courier.
{ "courier_id": "cour_…", "type": "region", "regions": ["16", "09", "35"] }A courier has one rule of each type: adding regions or products to a courier that already has that rule extends it. A region or a product is routed to one courier only, and weight ranges can't overlap; a clash is request_rejected, naming the courier that has it. PATCH replaces a rule's lists, DELETE removes it.
