Integration guide
.NET / C# integration
The Delivery Zone API is a simple JSON over HTTP endpoint. Call it from HttpClient in any .NET application — ASP.NET Core, Azure Functions, or a background service.
When to call the API
Call the API from your ASP.NET controller or service layer before confirming the order. Never expose the API key or route the call through the client.
Important: keep API keys server-side: Store the API key in environment variables or
appsettings.json (via secrets). Never hardcode it or expose it in client-facing code.
Code example
// .NET / C# — server-side, inject via IHttpClientFactory
var payload = new {
destinationPostcode = postcode,
basketValueCents = basketCents,
};
var response = await httpClient.PostAsJsonAsync(
"https://api.deliveryzone.fi/api/v1/delivery/check",
payload
);
var result = await response.Content.ReadFromJsonAsync<DeliveryCheckResult>();
if (!result.CanDeliver) {
// Reject order: result.ReasonCode
}
Error handling
When canDeliver is false (or null), the response includes a reasonCode field. Display this to the customer:
NOT_DELIVERABLE— postcode is outside your delivery zones, or not recognised (the API intentionally uses one generic code for both, to protect zone boundaries)MINIMUM_ORDER_NOT_MET— basket value is below the zone's minimum orderBASKET_VALUE_REQUIRED— a basket value is needed to evaluate this destination's minimum-order or free-delivery rule
Always handle HTTP errors (5xx, timeout) gracefully. If the API is unreachable, fail safe — either reject the order or allow manual review.
Implementation checklist
- Inject HttpClient via dependency injection (IHttpClientFactory)
- Store API key in environment variables or user secrets
- Handle HTTP errors and timeouts with try/catch
- Test against a non-production delivery zone first
- Confirm rejection behaviour in your staging environment
Ready to add postcode validation?
Free plan. No credit card. Real setup help.