Integrating 1C-Bitrix with the Dalli delivery aggregator

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages

Integration of 1C-Bitrix with Dalli delivery aggregator

Dalli Service is a logistics operator and aggregator specializing in delivery for online stores. Combines own courier service and partner carriers. Feature: same-day or next-day delivery in Moscow and Saint Petersburg, integration with marketplaces (Wildberries, Ozon, Yandex.Market).

What Dalli API provides

Dalli API — REST, authorization by token. Documentation available at dalli.ru partner portal.

Main operations:

  • Delivery cost calculation
  • Creating requests (single and batch)
  • Getting statuses
  • Pickup point list
  • Getting labels (PDF)
  • Webhook registration

Dalli works mainly by model: shop sends requests via API, Dalli distributes among own service and partners depending on address and deadlines.

Delivery module in Bitrix

Class inherits \Bitrix\Sale\Delivery\Services\Base. Parameters in b_sale_delivery_service_params:

  • DALLI_TOKEN — API token
  • SENDER_ID — ID of dispatch point (set up at connection)
  • DELIVERY_MODEexpress (same-day / next-day) or standard
  • COD_ALLOWED — cash on delivery allowed

Cost calculation

In calculateConcrete() pass address, dimensions, declared value. Dalli returns options with different timeframes (standard, express) and prices:

$calcResponse = $httpClient->post('/v1/calculate', [
    'sender_id'      => $senderId,
    'address'        => $recipientAddress,
    'weight'         => $weightGram,
    'dimensions'     => $dimensions,
    'declared_value' => $declaredValue,
    'delivery_types' => ['standard', 'express'],
]);

foreach ($calcResponse['variants'] as $variant) {
    // $variant['type'], $variant['price'], $variant['delivery_date']
}

If the store offers two delivery methods (standard and express), create two module instances with different DELIVERY_MODE in settings.

Express delivery same day

Dalli's key feature for Moscow and SPb. Works when:

  • Order accepted before certain time (usually before 14:00–15:00)
  • Sender warehouse in coverage zone
  • Goods physically ready to ship

In calculateConcrete() check current time: if date('H') >= $cutoffHour — same-day express unavailable, offer next-day delivery.

$currentHour = (int) date('H');
$cutoffHour  = 14; // Cutoff from module settings

if ($currentHour >= $cutoffHour) {
    $deliveryDate = date('d.m.Y', strtotime('+1 day'));
    $label = 'Delivery tomorrow, ' . $deliveryDate;
} else {
    $deliveryDate = date('d.m.Y');
    $label = 'Delivery today, ' . $deliveryDate;
}

Creating a request

$orderPayload = [
    'sender_id'      => $senderId,
    'external_id'    => 'SHOP-' . $bitrixOrderId,
    'delivery_type'  => $deliveryMode,
    'recipient'      => [
        'name'    => $name,
        'phone'   => $phone,
        'address' => $address,
    ],
    'packages' => [[
        'weight'     => $weightGram,
        'dimensions' => $dimensions,
        'items'      => $items,
    ]],
    'declared_value'  => $declaredValue,
    'cash_on_delivery'=> $codAmount,
    'comment'         => $comment,
];

Response: order_id in Dalli system. Get label via GET /orders/{id}/label.

Batch request creation

If orders accumulate during day, Dalli supports POST /orders/batch — creating multiple requests in one call. Manager clicks "Send to Dalli" in Bitrix admin — script collects all orders with "Ready to ship" status and sends batch.

Statuses

Webhooks: Dalli sends notifications to merchant URL. Register in account. Mapping:

Dalli Status Bitrix
accepted Accepted
on_the_way In transit
delivered Delivered
partially_delivered Partial acceptance
returned Return
failed Delivery error

Timeline

Scope Composition Timeline
Basic integration Calculation + requests + statuses 3–4 days
+ Express logic Time control, two methods +1–2 days
+ Batch sending Admin interface + batch API +2 days
+ Pickup points Loading + widget +2 days