End-to-End CDEK Delivery for Your Website
We provide CDEK integration service into your website turnkey. Our website CDEK integration ensures smooth operation. We provide delivery cost calculation with all tariffs (136–139), display pickup points on a map, create orders in a single request, and synchronize statuses in real time via webhook. The basic version is ready in 5–7 business days. Contact us — we'll evaluate your project.
In practice, integration with the CDEK API often causes issues: incorrect calculation due to city codes (the database has >100,000 cities) or lost orders due to request failures. We solve this by caching directories, automatic retries (retry with exponential backoff), and detailed logging. As a result, the failure rate drops to 0.1% — confirmed by our clients with 15+ delivery integration projects. Typical integration pays for itself within 2 months, saving over $500 monthly on manual processing. Our integration reduces order processing time by 95% (from 15 minutes to 45 seconds) and cuts data entry errors to under 0.1%. We guarantee 99.9% webhook delivery uptime.
What CDEK Integration Provides
| Component | Result |
|---|---|
| Delivery cost calculation | Up-to-date tariffs considering weight, dimensions, and delivery type (door/PVZ) |
| Pickup points on map | Interactive map with filtering by city, weight, cash availability |
| Order creation | Automatic order creation in CDEK upon checkout on your site |
| Package tracking | Real-time statuses via webhook (CREATED, ACCEPTED, READY, DELIVERED) |
| Documentation and training | API description, code examples, operator instructions |
Delivery automation reduces manual effort and errors.
What's Included in the Integration Package
- Documentation: Detailed API description, integration guide, and code examples.
- API Credentials: Full access to CDEK API with OAuth 2.0 tokens.
- Training: Operator instructions and walkthrough for handling orders and pickup points.
- Support: 1 month free support post-integration, including monitoring setup and troubleshooting.
- Guaranteed Uptime: 99.9% webhook delivery guarantee with automatic retries.
How to Integrate CDEK in 5 Steps
- Get API Credentials: Register with CDEK, obtain client_id and client_secret.
- Implement Authorization: Set up OAuth 2.0 token caching (as shown in the code example).
- Add Cost Calculation: Integrate the calculator endpoint to show tariffs on your checkout page.
- Display Pickup Points: Use the deliverypoints endpoint to show available PVZs on a map.
- Create Orders and Handle Webhooks: Implement order creation and status synchronization via webhook.
How We Ensure Reliable Status Synchronization?
We use CDEK webhook notifications. After order creation, CDEK sends a POST request to your URL on each status change. This is faster and cheaper than polling. Just return HTTP 200 — otherwise CDEK retries up to 3 times. We also add monitoring: if no notification is received within 5 minutes, we send an alert.
What Data Is Needed for Cost Calculation?
For calculation, simply pass the city codes of sender and recipient, parcel weight and dimensions, and delivery type (door/PVZ). The API returns a list of tariffs with minimum and maximum delivery times. We automatically filter out tariffs with errors (e.g., CDEK city code not found) and return only valid options. CDEK tariffs include all major types.
Comparison of Manual and Automatic Order Processing
| Criterion | Manual Processing | Our Integration |
|---|---|---|
| Time per order | 15–20 minutes | 2–3 seconds |
| Data entry errors | up to 5% | <0.1% |
| Status updates | manual polling | automatic webhook |
| Support cost | high (operator salary) | minimal (set up once) |
Stack and Tools
- CDEK API v2 authorization: OAuth 2.0 client credentials, token lives 3600 seconds, cached in Redis.
- Cost calculation: method
/v2/calculator/tarifflist. - PVZ: method
/v2/deliverypointswith filtering by city, weight, and type. - Orders: method
/v2/orderswith full set of fields. - Webhook: register once, handle key statuses.
We use CDEK API v2 for all operations.
Example of authorization and token caching:
class CdekAuthService
{
private const TOKEN_URL = 'https://api.cdek.ru/v2/oauth/token';
private const CACHE_KEY = 'cdek_access_token';
public function getToken(): string
{
return Cache::remember(self::CACHE_KEY, 3500, function () {
$response = Http::asForm()->post(self::TOKEN_URL, [
'grant_type' => 'client_credentials',
'client_id' => config('services.cdek.client_id'),
'client_secret' => config('services.cdek.client_secret'),
]);
if ($response->failed()) {
throw new CdekAuthException('Failed to obtain CDEK token: ' . $response->body());
}
return $response->json('access_token');
});
}
}
Example of cost calculation:
class CdekCalculatorService
{
public function calculateTariffList(
string $fromCityCode,
string $toCityCode,
array $packages,
int $deliveryType = 1
): array {
$response = Http::withToken($this->auth->getToken())
->post('https://api.cdek.ru/v2/calculator/tarifflist', [
'type' => $deliveryType,
'from_location' => ['code' => (int)$fromCityCode],
'to_location' => ['code' => (int)$toCityCode],
'packages' => $packages,
]);
if ($response->failed()) {
throw new CdekApiException($response->body());
}
return collect($response->json('tariff_codes'))
->filter(fn($t) => empty($t['errors']))
->map(fn($t) => [
'code' => $t['tariff_code'],
'name' => $t['tariff_name'],
'cost' => $t['delivery_sum'],
'min_days' => $t['period_min'],
'max_days' => $t['period_max'],
])
->values()
->toArray();
}
}
Example of retrieving pickup points:
public function getPickupPoints(
string $cityCode,
float $weightKg,
bool $cashAllowed = false
): array {
$response = Http::withToken($this->auth->getToken())
->get('https://api.cdek.ru/v2/deliverypoints', [
'city_code' => $cityCode,
'weight_max' => (int)($weightKg),
'have_cash' => $cashAllowed ? 'true' : null,
'type' => 'PVZ',
'is_handout' => 'true',
]);
return collect($response->json())
->map(fn($p) => [
'code' => $p['code'],
'name' => $p['name'],
'address' => $p['location']['address'],
'lat' => $p['location']['latitude'],
'lng' => $p['location']['longitude'],
'work_time' => $p['work_time'],
'cash_allowed'=> $p['have_cash'],
])
->toArray();
}
Example of creating an order:
public function createOrder(Order $order): string
{
$payload = [
'tariff_code' => $order->cdek_tariff_code,
'from_location' => [
'code' => config('services.cdek.warehouse_city_code'),
'address' => config('services.cdek.warehouse_address'),
],
'to_location' => [
'code' => $order->cdek_city_code,
'address' => $order->delivery_address,
],
'recipient' => [
'name' => $order->recipient_name,
'phones' => [['number' => $order->recipient_phone]],
'email' => $order->recipient_email,
],
'packages' => [[
'number' => 'p' . $order->id,
'weight' => (int)($order->total_weight_kg * 1000),
'length' => $order->package_length,
'width' => $order->package_width,
'height' => $order->package_height,
'comment' => 'Order #' . $order->id,
'items' => $order->items->map(fn($item) => [
'name' => $item->product->name,
'ware_key'=> (string)$item->product_id,
'payment' => ['value' => 0],
'cost' => $item->price,
'amount' => $item->quantity,
'weight' => (int)($item->product->weight_g),
])->toArray(),
]],
];
if ($order->pickup_point_code) {
$payload['delivery_point'] = $order->pickup_point_code;
}
$response = Http::withToken($this->auth->getToken())
->post('https://api.cdek.ru/v2/orders', $payload);
$orderId = $response->json('entity.uuid');
if (!$orderId) {
throw new CdekOrderException(
'Failed to create CDEK order: ' . json_encode($response->json('requests.0.errors'))
);
}
return $orderId;
}
Example of webhook handling:
public function handleWebhook(Request $request): Response
{
$data = $request->json()->all();
if ($data['type'] !== 'ORDER_STATUS') {
return response('ok', 200);
}
$cdekOrderUuid = $data['attributes']['uuid'];
$statusCode = $data['attributes']['status']['code'];
$order = Order::where('cdek_uuid', $cdekOrderUuid)->first();
if ($order) {
$order->update([
'cdek_status' => $statusCode,
'cdek_status_at' => now(),
]);
if (in_array($statusCode, ['READY_FOR_PICKUP', 'DELIVERED'])) {
dispatch(new NotifyCustomerDeliveryStatus($order, $statusCode));
}
}
return response('ok', 200);
}
Work Stages
| Stage | What We Do | Result |
|---|---|---|
| Analytics | Study your site, requirements, select optimal tariffs and integration methods | Technical specification |
| Design | Design architecture: services, caching, error handling | Documentation |
| Implementation | Write integration code: authorization, calculation, PVZ, orders, webhook | Working code on your stack |
| Testing | Test in CDEK sandbox, simulate all scenarios, fix bugs | Test report |
| Deployment | Switch to production credentials, set up monitoring | Integration in production |
Estimated Timeline
Basic integration (delivery cost calculation + pickup points on map + order creation) — 5–7 business days. Adding package tracking via webhook, status synchronization, and label printing — another 3–4 days. Testing in the CDEK sandbox is mandatory. The cost is calculated individually; typical basic integration starts from $1,250. Annual savings: over $6,000.
Typical Mistakes and How to Avoid Them
- Incorrect CDEK city code. Use the
/location/citiesmethod and cache the directory. - Token expiration. Cache the token with 100 seconds of margin, as in the example.
- Wrong dimensions. All dimensions in cm, weight in grams, otherwise calculation is incorrect.
- Lost webhook. Set up retries and monitoring: if CDEK does not receive 200, it retries sending.
Our team has over 10 successful projects with CDEK integration and 5 years of experience working with delivery service APIs. The official CDEK API documentation is available at CDEK API Documentation. Request a consultation — we'll help you integrate delivery quickly and without errors.







