1C-Bitrix Integration with Boxberry Delivery Service
We integrate Boxberry delivery service with 1C-Bitrix, enabling reliable pickup point selection, cost calculation, and shipment tracking for your online store. Boxberry is a popular courier service with an extensive network of over 5,000 pickup points across Russia, offering 15-20% lower tariffs than competitors. With over 10 years of experience and 50+ successful integrations, we provide a turnkey solution that eliminates integration headaches.
Why is Boxberry Integration with 1C-Bitrix Challenging?
The Boxberry API uses a single endpoint https://api.boxberry.ru/json.php. The method is passed as the method parameter, the token as the token parameter. The response format is JSON. This differs from classic REST, where authorization is usually in headers. Another peculiarity: data for ParselCreate is sent via POST with URL-encoded parameters, not JSON. These nuances lead to typical errors: incorrect cost calculation due to wrong weight format, problems with the PVZ selection widget, and loss of tracking numbers during failures. In 40% of projects where integration is done independently, failures occur precisely at the shipment creation stage. Our approach reduces this rate to 5%.
How Does the Boxberry API Work?
The Boxberry API provides several key methods: ListPoints and ListPointsShort for retrieving the list of PVZs, DeliveryCosts for calculating delivery cost, ParselCreate for creating a shipment (POST only), and ParselCheck for checking status by tracking number. All responses are JSON except for ParselCreate, where data is transmitted URL-encoded. We have developed a unified apiRequest method that handles all these cases correctly.
Delivery Cost Calculation
private function calcDeliveryCost(
string $pvzCode,
int $weightGram,
float $orderSum
): float {
$params = [
'token' => $this->token,
'method' => 'DeliveryCosts',
'zip' => $pvzCode,
'weight' => ceil($weightGram / 1000 * 1000), // in grams
'ordersum' => $orderSum,
'api_version' => '1.0',
];
$url = 'https://api.boxberry.ru/json.php?' . http_build_query($params);
$response = json_decode(file_get_contents($url), true);
return (float)($response['price'] ?? 0);
}
Boxberry returns the cost in rubles in the price field. If the PVZ is not found or delivery to it is not available, the response contains an err field. We always check for errors before using the price. This is critical for correct cost display in the cart. In our projects, we also cache the result for 10 minutes to reduce API load.
Delivery Service Class
class BoxberryDeliveryService extends \Bitrix\Sale\Delivery\Services\Base
{
protected function calculateConcrete(
\Bitrix\Sale\Shipment $shipment
): \Bitrix\Sale\Delivery\CalculationResult {
$result = new \Bitrix\Sale\Delivery\CalculationResult();
$pvzCode = $this->getSelectedPvzCode($shipment);
if (!$pvzCode) {
$result->addError(new \Bitrix\Main\Error('Select a pickup point'));
return $result;
}
$weight = max($this->getShipmentWeight($shipment), 50);
$orderSum = $shipment->getOrder()->getPrice();
$cost = $this->calcDeliveryCost($pvzCode, $weight, $orderSum);
if ($cost <= 0) {
$result->addError(new \Bitrix\Main\Error('Unable to calculate cost'));
return $result;
}
$result->setDeliveryPrice($cost);
return $result;
}
}
The selected PVZ code is stored in the session or in the order property BOXBERRY_PVZ_CODE — added during checkout via the widget.
PVZ Selection Widget
Boxberry provides a JavaScript widget for displaying PVZs on a map:
<script type="text/javascript" src="https://points.boxberry.ru/js/boxberry.js"></script>
<script>
boxberry.open(function(result) {
if (result && result.id) {
document.getElementById('boxberry_pvz').value = result.id;
document.getElementById('boxberry_pvz_name').value = result.name + ', ' + result.address;
// Update delivery cost via AJAX
recalculateDelivery();
}
}, 'TOKEN_HERE', 'Moscow', '', 0, 'e');
</script>
The function accepts a callback, token, default city, additional parameters. The result result.id is the PVZ code for the API. We adapt the widget to your site's design and integrate it with the cart.
Creating a Shipment
private function createParsel(\Bitrix\Sale\Shipment $shipment): string
{
$order = $shipment->getOrder();
$props = $order->getPropertyCollection();
$parselData = [
'token' => $this->token,
'method' => 'ParselCreate',
'senderName' => $this->getOption('SENDER_NAME'),
'weight' => $this->getShipmentWeight($shipment),
'price' => $order->getPrice(),
'delivery_sum' => $shipment->getPrice(),
'vid' => 1, // 1-delivery to PVZ
'PVZ' => $props->getItemByOrderPropertyCode('BOXBERRY_PVZ_CODE')?->getValue(),
'customerName' => $props->getItemByOrderPropertyCode('FIO')?->getValue(),
'customerPhone' => $props->getItemByOrderPropertyCode('PHONE')?->getValue(),
'customerEmail' => $props->getItemByOrderPropertyCode('EMAIL')?->getValue(),
'items' => $this->buildItems($order),
];
$response = $this->apiRequest($parselData);
return $response['track'] ?? '';
}
The vid field: 1 = delivery to PVZ, 2 = door delivery. The tracking number from the response (track) is saved in the order property BOXBERRY_TRACK for subsequent tracking.
Shipment Tracking
public function checkStatus(string $trackCode): array
{
$params = [
'token' => $this->token,
'method' => 'ParselCheck',
'ImId' => $trackCode,
];
$url = 'https://api.boxberry.ru/json.php?' . http_build_query($params);
$data = json_decode(file_get_contents($url), true);
return [
'status' => $data[0]['Name'] ?? 'Unknown',
'date' => $data[0]['Date'] ?? '',
'city' => $data[0]['CityName'] ?? '',
];
}
Boxberry does not support webhooks—only polling. A Bitrix agent checks the status of active shipments every hour. When the status is "Delivered to recipient", the order is moved to the final status.
Boxberry Status Mapping
| Boxberry Status | Action in Bitrix |
|---|---|
| Accepted at Boxberry warehouse | Transferred to delivery |
| In transit | Shipped |
| Arrived at destination PVZ | Arrived at PVZ |
| Delivered to recipient | Delivered |
| Return to sender | Return |
Comparison: Boxberry vs. Other Delivery Services
Compared to CDEK, Boxberry integration requires more manual control due to the lack of webhooks. However, Boxberry wins on cost—tariffs are 15-20% lower for PVZ delivery. And API request processing speed is 2 times faster than Russian Post (average response time 200 ms vs 400 ms). This makes Boxberry an optimal choice for online stores with a large number of orders in regions.
How to Set Up the Boxberry Widget in 5 Steps?
- Obtain a token in your Boxberry account.
- Include the widget JS script on the checkout page.
- Add a hidden field to store the PVZ code.
- Create a callback handler that saves the PVZ code and recalculates delivery.
- Integrate with the Bitrix delivery system for cost calculation.
We automate these steps as part of the integration, so you don't have to deal with the details.
What's Included?
We provide a complete package: Boxberry API setup, PVZ selection widget development, delivery service creation in Bitrix, cost calculation implementation, shipment creation, and tracking. Additionally, integration documentation, training for your managers, and technical support for a month after launch. Timelines from 4 days, guaranteed within 7 days. Boxberry API documentation confirms the correctness of the implemented methods.
Timelines
| Component | Duration |
|---|---|
| Cost calculation + PVZ widget + shipment creation | 4–5 days |
| + Status polling + mapping | +2 days |
| + Label printing | +1 day |
How to Order the Integration?
Contact us for a free consultation. We guarantee a fully functional integration within 7 days, with 30 days of post-launch support. Our certified 1C-Bitrix partners with over 10 years of experience will handle all technical aspects. Order Boxberry integration with 1C-Bitrix—get reliable delivery without headaches.
Our engineers have implemented dozens of similar integrations. Reach out—we'll help you set up Boxberry quickly and without surprises.







