The Delivery Zone API works with any backend language or framework. Send a POST to /v1/check from your server with the customer's postcode and basket value. The response tells you whether you can deliver, which zone applies, and what price to charge.
Call the API server-side during checkout validation — before presenting payment options and before any charge is attempted.
// Server-side only — never expose your API key in browser code
const res = await fetch('https://api.deliveryzone.fi/v1/check', {
method: 'POST',
headers: {
'X-Api-Key': process.env.DZ_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({ destinationPostcode: postcode, basketValueCents: basket }),
});
const data = await res.json();
if (!data.canDeliver) {
showError(data.reason); // e.g. "OUT_OF_ZONE"
} else {
setShippingFee(data.priceCents);
}
When canDeliver is false, the response includes a reason field. Display this to the customer:
OUT_OF_ZONE — postcode is valid but outside all defined zonesUNKNOWN_POSTCODE — postcode is not recognisedMIN_BASKET — basket value is below the zone minimumAlways handle HTTP errors (5xx, timeout) gracefully. If the API is unreachable, fail safe — either reject the order or allow manual review.
Create a free account and get your sandbox API key in minutes.