1C-Bitrix Integration with IML Delivery Service
IML is a Russian delivery service with its own network of pickup points and courier delivery. Coverage includes over 5000 towns, with focus on e-commerce. For Bitrix shops, three scenarios are relevant: courier delivery to door, delivery to pickup point (PVZ), and self-pickup from PVZ with fitting room.
IML API: Structure and Authorization
IML provides REST API. Base URL: https://api.iml.ru. Authorization via Basic Auth (credentials from IML personal account). All requests are POST with JSON body, responses also in JSON.
Key endpoints:
-
POST /api/v2/auto-zones— calculate zone and delivery cost by address/postal code -
POST /api/v2/orders— create delivery request -
GET /api/v2/orders/{orderNumber}— request status -
GET /api/v1/delivery-points— list of pickup points (can be large — cache it) -
GET /api/v2/tracking/{barcode}— detailed tracking
Delivery Module in Bitrix
Delivery class inherits \Bitrix\Sale\Delivery\Services\Base. For displaying pickup points on map, additionally implement separate component or integrate with existing pickup point selection widget if present.
Parameters in b_sale_delivery_service_params:
-
IML_LOGIN,IML_PASSWORD -
SENDER_CODE— sender code (issued by IML at connection) -
DELIVERY_TYPE— default delivery type (courier/pickup)
Cost Calculation and Zone
IML calculates cost by zone: first, delivery zone is determined by town, then cost is calculated from tariff grid based on weight and dimensions.
$response = $httpClient->post(
'https://api.iml.ru/api/v2/auto-zones',
[
'RegionCodeFrom' => $senderRegionCode,
'RegionCodeTo' => $deliveryRegionCode,
'Weight' => $weightGram,
'Volume' => $volumeCm3,
'AssessedValue' => $assessedValue,
'DeliveryType' => 'CurierDelivery', // or 'PickupPoint'
]
);
$deliveryPrice = $response['Price'];
$deliveryDays = $response['DeliveryTime'];
IML region codes are proprietary classification. On first run, load region directory via GET /api/v2/regions and save to b_option (or separate table) for quick search.
Creating Request
Upon order confirmation and selection of IML delivery method, form a request:
$orderData = [
'SenderCode' => $senderCode,
'OrderNumber' => 'SHOP-' . $bitrixOrderId,
'ReceiverName' => $receiverName,
'Phone' => $phone,
'RegionCode' => $regionCode,
'AddressString' => $address,
'Weight' => $weightGram,
'GoodsDescription' => 'Shop goods',
'AssessedValue' => $assessedValue,
'CashOnDelivery'=> $codAmount, // cash on delivery, 0 if prepaid
'DeliveryType' => 'CurierDelivery',
];
Response contains BarCode — shipment barcode. Save to b_sale_order_props as IML_BARCODE.
Pickup Points and Selection Map
Pickup points list is returned by GET /api/v1/delivery-points — large array (thousands of objects). Load once per day via Bitrix agent and cache in HL-block or b_iblock_element table (infoblock "IML Pickup Points").
On checkout page, display map with pickup points: Yandex.Maps or Google Maps with markers. Upon selection, save its code to order property IML_PICKUP_POINT. When creating request, pass PickupPointCode instead of address.
Statuses and Tracking
Status synchronization via Bitrix agent: every 30–60 minutes, poll GET /api/v2/orders/{orderNumber} for active orders. IML also supports webhooks (sending notifications to merchant URL) — preferable with high order volume.
| IML Status | Bitrix Status |
|---|---|
| Accepted | Sent for delivery |
| In transit | In transit |
| Arrived at pickup point warehouse | Waiting at pickup point |
| Delivered | Delivered |
| Return initiated | Return |
Cash on Delivery
IML supports cash on delivery (COD). CashOnDelivery amount = order cost if customer pays upon receipt. When configuring two payment methods (prepaid / upon receipt) in Bitrix, COD selection logic is implemented in calculateConcrete().
Timeline
| Scope | Components | Duration |
|---|---|---|
| Basic integration | Calculation + creating requests + tracking | 4–5 days |
| + Pickup point map | PVZ infoblock + map widget | +3 days |
| + Cash on delivery | COD logic + payment sync | +1–2 days |







