Beta Delivery Zone is in private beta and not yet open to customers — public launch coming soon.
Integration guide

Call the Delivery Zone API from PHP

The Delivery Zone API accepts a JSON POST and returns a JSON response. Call it using file_get_contents with a stream context, cURL, or wp_remote_post in WordPress.

Get free API key API reference

When to call the API

Call the API inside your PHP request handling code — in a controller, a WordPress filter, or an API endpoint. Always server-side.

API key security: Never expose the API key in JavaScript output, HTML source, or any client-visible file. Store it in a config file outside the web root, an environment variable, or WordPress options.

Request example

// PHP — server-side, keep API key out of frontend
$r = wp_remote_post('https://api.deliveryzone.fi/v1/check', [
  'headers' => [
    'X-Api-Key'    => get_option('dz_api_key'),
    'Content-Type' => 'application/json',
  ],
  'body' => json_encode([
    'destinationPostcode' => $postcode,
    'basketValueCents'    => $basketCents,
  ]),
]);
$data = json_decode(wp_remote_retrieve_body($r), true);
if (!$data['canDeliver']) return [];
foreach ($rates as $rate) {
  $rate->cost = $data['priceCents'] / 100;
}

Error handling

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 zones
  • UNKNOWN_POSTCODE — postcode is not recognised
  • MIN_BASKET — basket value is below the zone minimum
Always handle HTTP errors (5xx, timeout) gracefully. If the API is unreachable, fail safe — either reject the order or allow manual review.

Production checklist

  • Store API key in an environment variable or WordPress option
  • Validate postcode is 5 digits before calling the API
  • Handle cURL/wp_remote_post errors and non-200 responses
  • Test with sandbox key first
  • Confirm WooCommerce rejection behaviour if using WooCommerce

Ready to integrate?

Create a free account and get your sandbox API key in minutes.