DPD API Integration: PHP Code Examples & Guide

This guide helps you integrate DPD delivery on your website quickly. When integrating DPD, developers often stumble on the SOAP protocol: errors in the response body, a proprietary city encoding system, and non-obvious fields for orders. For example, to create an order, you need to pass city codes f

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1026
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

This guide helps you integrate DPD delivery on your website quickly. When integrating DPD, developers often stumble on the SOAP protocol: errors in the response body, a proprietary city encoding system, and non-obvious fields for orders. For example, to create an order, you need to pass city codes from the DPD directory, not KLADR — otherwise the API returns a city not found error. Calculating the cost requires cargo volume: length × width × height / 1,000,000. Without a ready SDK, self-development takes up to 10 days and may lead to errors in response handling. We have accumulated experience on 15+ projects and halved this timeframe. Professional integration can help reduce shipping costs by selecting the optimal tariff and caching directories. The exact cost is calculated individually after analysis.

DPD API Integration Steps

Connecting to DPD API

Install the SDK via Composer:

composer require dpd-ru/dpd-php-api-client 

Initialize the client with the test environment:

use DPD\DPDClient; $client = new DPDClient( username: config('services.dpd.username'), password: config('services.dpd.password'), clientNumber: config('services.dpd.client_number'), test: app()->environment('production') === false ); 

The test environment (test: true) runs at https://test.dpd.ru. Test credentials are requested from a DPD manager separately from production ones.

Key Integration Methods

Below are the main functions: cost calculation, city search, terminal retrieval, order creation, tracking, label printing, and courier call.

// --- Cost calculation --- public function calculateDelivery( string $fromCityId, // DPD city code (not ISO) string $toCityId, float $weightKg, array $dimensions, float $declaredValue = 0 ): array { $response = $this->client->getDPDOrderCost2([...]); // ... processing } // --- City search --- public function findCity(string $cityName, string $countryCode = 'RU'): array { $response = $this->client->getCitiesCashPay([...]); // ... } // --- Pickup points --- public function getTerminals(?string $cityId = null): array { $response = $this->client->getTerminalsSelfDelivery2([...]); // ... } // --- Create order --- public function createOrder(Order $order): array { $response = $this->client->createOrder([...]); // ... } // --- Tracking --- public function trackParcel(string $dpdOrderNum): array { $response = $this->client->getStatesByClient([...]); // ... } // --- Print label --- public function printLabel(string $dpdOrderNum, string $format = 'PDF'): string { $response = $this->client->createLabelFile([...]); // ... } // --- Courier call --- public function createPickupRequest(...): string { // ... } 
Full code example for all methods

Full implementations of each method (with parameters and error handling) are provided as part of turnkey integration. Contact us to get the ready code.

Cost Calculation Configuration

  1. Obtain test credentials from a DPD manager.
  2. Install the SDK via Composer.
  3. Initialize the client with test: true.
  4. Call the getDPDOrderCost2 method, passing city codes, weight, and dimensions.
  5. Process the response: check the status, extract the cost for each service.

Caching the city directory reduces the number of requests by 80%. The average calculation time is less than 500 ms.

Calculating the cost requires passing sender and recipient city codes, weight, and dimensions. DPD returns the cost for each available service. The SDK automatically processes the response and forms an array with prices. Comparing costs from different services allows automatic selection of the most advantageous option, saving up to 30% on shipping.

Supported DPD Delivery Services

Service Code Name Description
BZP Business Parcel Door-to-door delivery, up to 30 kg
PCL Parcel to Terminal Delivery to pickup point, up to 20 kg
MAX Maxi Large cargo up to 1000 kg
EXPRESS Express Urgent delivery in 1–2 days

Additional services with special conditions are also supported, such as "Parcel Return" for returns.

Test vs Production Environment

Parameter Test Environment Production Environment
URL https://test.dpd.ru https://ws.dpd.ru
Credentials Test (from manager) Production
Order Creation Does not create real orders Creates orders
Errors Possible timeouts Stable

Using the official SDK reduces development time by 2 times compared to implementing SOAP requests from scratch.

What Are the Benefits of Professional DPD Integration?

Benefits of Professional Integration

The SOAP specification of DPD contains many nuances: responses return errors in the body, not HTTP statuses; city codes do not match KLADR; a proprietary mapping system is required. Our certified engineers have integrated DPD for 15+ projects, so we guarantee:

  • Correct handling of all response types (including errors with status !== 'OK')
  • Query optimization: caching of city directory, parallelization of calculations
  • Support for all services: from PCL to EXPRESS
  • Reduction of development time to 5–7 days for basic integration

Professional integration is 40% cheaper than self-implementation due to the absence of errors and wasted time.

How Much Does DPD Integration Cost?

  • Connecting to DPD API (obtaining accesses, configuring SDK)
  • Implementing cost calculation with service selection and dimension consideration
  • Integrating a map of pickup points with filtering and display of working hours
  • Creating orders with automatic data transfer to DPD
  • Tracking statuses and updating order status in your system
  • Printing labels in PDF or ZPL formats for thermal printers
  • Courier call for shipment pickup
  • Testing on test and production environments
  • Integration documentation and support for one month after launch

Basic integration (calculation, pickup points, order creation, tracking) — from 5 to 7 days. Extended integration (including courier call, label printing, multi-warehouse) — from 10 days. Basic integration starts at $1,500 and extended integration from $3,000. The cost is calculated individually based on the scope of work. Contact us for a project assessment — we will prepare a commercial proposal within 1 day. Get a consultation on DPD integration right now.

How to Avoid Common Self-Implementation Pitfalls?

  • Response errors: DPD does not use HTTP statuses; each operation requires checking the status in the response body.
  • City codes: a separate search via getCitiesCashPay is required as DPD uses its own numbering.
  • Cargo volume: the volume parameter is calculated in cubic meters; an error in the formula leads to incorrect cost.
  • Timeouts: requests to the test environment can be slow; caching of directories is recommended.

Logistics integration for online stores includes cost calculation and order creation. SOAP integration DPD requires careful attention to city codes and volume calculation.