Bitrix-Dostavista integration via REST API

Integration of 1C-Bitrix with Dostavista Delivery Service A customer places an order at 18:30, and the courier arrives only the next day by noon? The reason is manual order creation in the delivery service. The manager spends 15 minutes filling in data: address, weight, contacts. An error in the

Our competencies:

Frequently Asked Questions

Integration of 1C-Bitrix with Dostavista Delivery Service

A customer places an order at 18:30, and the courier arrives only the next day by noon? The reason is manual order creation in the delivery service. The manager spends 15 minutes filling in data: address, weight, contacts. An error in the phone number—and the courier can't call. Integration of 1C-Bitrix with Dostavista via REST API eliminates the human factor and speeds up delivery to 1–2 hours. We, a team of certified Bitrix developers with 10+ years of experience and over 50 successful projects, offer turnkey implementation. On average, the project takes 3–6 days depending on complexity.

Why Integrate with Dostavista?

Manual creation of delivery requests leads to delays, errors, and lost customers. Automation via REST API of Dostavista allows you to reduce delivery time—the request goes to the courier within seconds after order confirmation. Eliminate errors—addresses and contacts are transferred automatically. Increase loyalty—the customer sees the status and location of the courier in real time. The Dostavista API is better than SOAP integrations with bulky XML schemas: REST requests are lighter, documentation is transparent, and response time is 2–3 times lower.

How Dostavista API Works

Dostavista provides a REST API. Authorization is done via a token in the X-Authorizationtoken header. Main methods:

  • POST /api/business/v1/orders — create a delivery request
  • GET /api/business/v1/orders/{id} — get request status
  • DELETE /api/business/v1/orders/{id} — cancel request
  • GET /api/business/v1/couriers/{id}/location — courier coordinates

The request contains route points (points array): point 0 is the pickup location (warehouse/store), points 1..N are the delivery addresses of customers. One Dostavista order can contain multiple delivery points—this is convenient for batch shipments.

Delivery Module in Bitrix

The delivery service is connected via a class inheriting \Bitrix\Sale\Delivery\Services\Base. Key methods:

  • calculateConcrete() — calculates shipping cost. Calls POST /api/business/v1/orders/calculate-price with pickup/delivery address and weight.
  • createDelivery() — creates the actual request when the order is confirmed by the manager or automatically on status change.
  • Handler OnSaleStatusOrder — hook on order status change in b_sale_order.

Module parameters are stored in b_sale_delivery_service_params: API_TOKEN, SHOP_POINT_ADDRESS (warehouse address), AUTO_CREATE (create request automatically).

Shipping Cost Calculation

$response = $httpClient->post( 'https://robot.dostavista.ru/api/business/v1/orders/calculate-price', [ 'matter' => 'Товар из магазина', 'weight_kg' => $weightKg, 'points' => [ ['address' => $shopAddress], [ 'address' => $deliveryAddress, 'contact_person' => ['phone' => $phone], ], ], ], ['X-Authorizationtoken' => $apiToken] ); $price = $response['order']['payment_amount']; 

The response contains payment_amount—the amount to pay (in local currency). If the address is not recognized or falls outside the coverage area, the API returns an error—we handle that as "delivery unavailable".

How to Automate Order Creation in Bitrix

The request is created either automatically when the customer selects the delivery method and order is confirmed, or manually by the manager from the admin panel. The second option is preferable for stores that need to check stock before dispatch.

In b_sale_order_props, we save DOSTAVISTA_ORDER_ID—the request ID in the Dostavista system. It is needed for:

  • tracking request status (polling or webhook)
  • canceling the request when the order is canceled in Bitrix
  • providing the customer with a tracking link for the courier

Statuses and Synchronization

Dostavista supports webhooks: when the status of a request changes, the system sends a POST request to the specified URL. Configure it in your personal account. On the Bitrix side, we create a handler that maps Dostavista statuses to order statuses:

Dostavista Status Bitrix Order Status
awaiting_executor Transferred to delivery
active Courier en route
completed Delivered
canceled Canceled
failed Delivery error

If webhooks are not available (no public IP), we implement polling: a Bitrix agent polls the status of active requests every 5–10 minutes via GET /api/business/v1/orders/{id}.

Courier Tracking

Dostavista returns courier.latitude/courier.longitude in the request when delivery is active. For stores that want to show the courier's position on a map, we implement an AJAX endpoint on the Bitrix side—it forwards the request to the Dostavista API and returns coordinates.

Timelines

Scope Components Duration
Basic integration Cost calculation + order creation 3–4 days
+ Auto-creation + statuses Status hook + mapping + polling 5–6 days
+ Courier tracking AJAX endpoint + site widget +2 days

What's Included

We provide a full cycle of services: analysis of logistics processes, configuration of API tokens and access rights, development of a custom delivery module tailored to the store's specifics, implementation of status handlers (webhooks or polling), creation of an AJAX tracking widget on a map, production testing, documentation, and manager training. We guarantee stable operation of the integration and prompt support after launch. If you want to automate delivery in your store, contact us. Get a free consultation on your project.