Display the resolved zone delivery fee at checkout.
The priceCents property is an integer in cents (e.g. 590 = €5.90). Divide by 100 for display or use directly with payment processors.
// PHP — server-side, keep API key out of frontend
$response = wp_remote_post('https://api.deliveryzone.fi/api/v1/delivery/check', [
'headers' => [
'X-Api-Key' => get_option('dz_api_key'),
'Content-Type' => 'application/json',
],
'body' => wp_json_encode([
'destinationPostcode' => $postcode,
'basketValueCents' => $basket_cents,
]),
]);
$data = json_decode(wp_remote_retrieve_body($response), true);