Skip to main content

DPD Integration

The DPD integration enables shipment creation, PDF label generation, and parcel tracking via the DPD/BRT REST API.

Components

ComponentFileRole
DpdApisrc/CoreBundle/Api/DpdApi.phpREST API client for DPD
DpdServicesrc/CoreBundle/Services/DpdService.phpShipment business logic
DpdControllersrc/AppBundle/Controller/DpdController.phpDashboard and web routes
Configurationapp/config/parameters.yml.distConnection parameters

Configuration

Required parameters in parameters.yml:

dpd:
api_url: "https://api.dpd.fr"
user_id: "..."
password: "..."
customer_code: "..."
departure_depot: "..."
operating_mode: "..."

:::info Parameter injection pattern Symfony does not allow accessing nested parameters (%dpd.api_url%). The service receives the full %dpd% array and extracts keys in PHP. This pattern is consistent with other carrier integrations (Geodis, etc.). :::

Data Flow

Dashboard Features

  • Shipment list with DataTables (server-side pagination)
  • Advanced filters (store, dates, tracking number, order number)
  • Batch shipment creation
  • PDF label download
  • Retry for failed shipments
  • Tracking synchronization

API Error Codes

CodeMeaning
-1General error
-3Invalid parameters
-5Authentication failed
-10Unknown depot
-11Unknown customer code
-21Shipment not found
-22Shipment already confirmed
-30Service unavailable

Integration Phases

Phase 1 -- API and Backend Services

  • REST API client (DpdApi)
  • Business logic service (DpdService)
  • PDF label storage
  • SaleProduct updates

Phase 2 -- User Interface

  • DPD dashboard with DataTables
  • AJAX routes for creation and tracking
  • Integration into the "Processing Not Printed" flow
  • Filters and carrier-based search

Phase 3 (optional)

  • Automated batch printing
  • Automatic tracking synchronization command
  • Email notifications
  • Webhooks
  • Statistics dashboard

Troubleshooting

ParameterNotFoundException for %dpd.api_url%

The service must receive %dpd% (the full array), not individual keys. Verify that services.yml passes %dpd% and that the DpdApi constructor accepts array $config.

Dashboard inaccessible

  1. Clear cache: php bin/console cache:clear
  2. Check the service: php bin/console debug:container mz.dpd.api
  3. Test the API connection manually