When conducting e-commerce in Belarus, connecting the local delivery service Avtolightexpress to 1C-Bitrix is a task that many store owners face.
There are no standard modules for its API, and manually creating orders in the carrier's personal account leads to wasted time and errors.
We set up a seamless integration for an online home appliance store from Minsk: now orders are created automatically, delivery cost is calculated in the cart, and statuses are updated without manager involvement.
Over six months, more than 5,000 orders passed through this integration with a cost calculation accuracy of 99%. The average logistics savings amounted to 15–20% through automation.
Our client faced a problem: standard delivery services (Belpochta, CDEK) did not provide the required speed within Minsk. Avtolightexpress offered same-day delivery but required integration. We developed a module based on the carrier's API.
The Avtolightexpress API is REST with token-based authorization. The base URL format is https://api.avtolight.by/v1. Authorization via the header Authorization: Bearer <token>.
How does the integration with Avtolightexpress work?
Main methods:
POST /calculate— cost calculationPOST /order— order creationGET /order/{id}— order statusGET /points— list of pickup points
Cost calculation and order creation
Let's implement a calculation handler class inheriting from \Bitrix\Sale\Delivery\Services\Base. The calculateConcrete method builds a request with parameters: sender/recipient city, weight, dimensions, order total, and delivery type. If the response contains a price, we set the delivery cost and period.
class AvtolightHandler extends \Bitrix\Sale\Delivery\Services\Base
{
protected function calculateConcrete(
\Bitrix\Sale\Shipment $shipment
): \Bitrix\Sale\Delivery\CalculationResult {
$result = new \Bitrix\Sale\Delivery\CalculationResult();
$order = $shipment->getOrder();
$props = $order->getPropertyCollection();
$response = $this->apiPost('/calculate', [
'city_from' => $this->getOption('SENDER_CITY'),
'city_to' => $this->getOrderCity($props),
'weight' => max($shipment->getWeight() / 1000, 0.1),
'length' => (float)$this->getOption('DEFAULT_LENGTH', 20),
'width' => (float)$this->getOption('DEFAULT_WIDTH', 20),
'height' => (float)$this->getOption('DEFAULT_HEIGHT', 10),
'sum' => round($order->getPrice()),
'type' => $this->getOption('DELIVERY_TYPE', 'pvz'), // pvz or courier
]);
if (!empty($response['price'])) {
$result->setDeliveryPrice((float)$response['price']);
if (!empty($response['days'])) {
$result->setPeriodDescription($response['days'] . ' days');
}
}
return $result;
}
public function createOrder(\Bitrix\Sale\Shipment $shipment): string
{
$order = $shipment->getOrder();
$props = $order->getPropertyCollection();
$payload = [
'external_id' => 'bitrix_' . $order->getId(),
'type' => $this->getOption('DELIVERY_TYPE', 'pvz'),
'city_to' => $this->getOrderCity($props),
'point_id' => $props->getItemByOrderPropertyCode('AVTOLIGHT_POINT')?->getValue(),
'name' => $props->getItemByOrderPropertyCode('FIO')?->getValue(),
'phone' => $props->getItemByOrderPropertyCode('PHONE')?->getValue(),
'address' => $props->getItemByOrderPropertyCode('ADDRESS')?->getValue(),
'weight' => max($shipment->getWeight() / 1000, 0.1),
'sum' => round($order->getPrice()),
'cod' => $this->getCodAmount($order),
'comment' => 'Order #' . $order->getId(),
'items' => $this->buildOrderItems($shipment),
];
$response = $this->apiPost('/order', $payload);
return (string)($response['id'] ?? '');
}
}
What are the integration specifics?
Cities: Avtolytekspress operates primarily in major cities of Belarus (Minsk, Brest, Vitebsk, Grodno, Gomel, Mogilev). For other localities, delivery may be unavailable — this needs to be checked during calculation.
COD: the company supports cash on delivery. Funds are transferred to the store's account weekly or once a certain amount has accumulated — specified in the contract.
private function getCodAmount(\Bitrix\Sale\Order $order): float { // If the order is paid online — COD = 0
if ($order->isPaid()) {
return 0.0;
}
return round($order->getPrice(), 2);
}
How to set up order tracking?
The Bitrix agent polls the status every 3 hours for active orders. Company statuses are specific — the mapping is agreed upon with the Avtolaytekspress manager during onboarding.
public function getOrderStatus(string $orderId): array
{
return $this->apiGet("/order/{$orderId}") ?? [];
}
Mistakes to avoid
- Lack of status mapping: Autolightexpress statuses ("Accepted", "In transit", "Delivered") may not match Bitrix internal statuses.
- Incorrect COD calculation for partial payment: if the customer paid part online and part cash on delivery, the difference must be passed.
- Ignoring unavailable cities: if the destination point is outside the coverage area, the API returns an error, and the order must not be created.
Why choose our integration?
We have 10+ years of experience with 1C-Bitrix and more than 50 successful projects integrating with logistics services (CDEK, Russian Post, Boxberry, DPD). We guarantee the module works on all supported Bitrix versions. We provide experienced senior-level engineers.
Comparison of delivery services for Minsk
| Parameter | Avtolaytekspress | Belpochta | CDEK-BEL |
|---|---|---|---|
| Speed within Minsk | Same day | 2–3 days | 1–2 days |
| Cost (relative) | Medium | Low | High |
| Real-time tracking | Yes | No | Yes |
| API integration | REST | No (manual) | REST |
Based on our project experience, Avtolaytekspress delivers within Minsk 2 times faster than Belpochta and is 30% cheaper than a courier service.
Case study from our practice
Online home appliance store, Minsk. Our client used Avtolitexpress as a fast city delivery option (within Minsk — same day, in the region — 1–2 days). Belpochta operated in parallel for delivery across all of Belarus.
Order routing: if the address is in Minsk — we offer both options, if outside — only Belpochta/CDEK-BEL. Result: 15% reduction in logistics costs through automation. More than 200 orders per month are processed through the integration.
What is included in the integration
- Analysis of the current 1C-Bitrix configuration and delivery requirements
- Implementation of the delivery handler class (calculation, order creation, tracking)
- Configuration of order properties for pickup points and addresses
- Creation of an agent for updating statuses
- Integration taking into account fiscalization (54-FZ) if required
- Testing on the test environment and production stand
- Connection documentation and support for one month
- Training of employees to work with the new delivery service
- Transfer of access credentials and module source code
How to set up an agent to update statuses?
The agent is created in the local/php_interface/agent.php file and runs every 3 hours. It retrieves a list of active orders with an associated delivery ID, calls getOrderStatus, and updates the order property with the current status.
When the final status "Delivered" is reached, the order is automatically marked as completed.
Estimated timelines
| Scope | Timeline |
|---|---|
| Calculation + order creation | 3–4 days |
| + List of pickup points | +2 days |
| + Tracking + notifications | +2 days |
Cost is calculated individually. We will evaluate your project within 1 business day. If you want to connect Autolaytexpress delivery within 3–4 days, submit a request — we will conduct an audit of your store.
For consultation and ordering, write to us — we will share the details. Get an integration estimate today!







