1C-Bitrix Integration with 5Post Delivery Service
5Post is a delivery service of X5 Retail Group (Pyaterochka, Perekrestok, Carousel). Main delivery channel — order pickup points at retail network locations. Coverage: over 15,000 pickup points across Russia. For e-shops, this means access to wide network within walking distance for customers.
5Post API
5Post provides REST API. Authorization via OAuth 2.0 (client_credentials). Production base URL: https://api.5post.ru. Test environment provided upon connection through 5Post personal account.
Main methods:
-
POST /api/v1/orders— create delivery request -
GET /api/v1/orders/{orderUUID}— request status -
DELETE /api/v1/orders/{orderUUID}— cancel -
GET /api/v1/pvz— list of pickup points with region/city filtering -
POST /api/v1/orders/calc— calculate delivery cost
Module in Bitrix
Delivery class inherits \Bitrix\Sale\Delivery\Services\Base. Parameters stored in b_sale_delivery_service_params: CLIENT_ID, CLIENT_SECRET, PARTNER_CODE (5Post partner code).
Getting token:
$tokenResponse = $httpClient->post('https://api.5post.ru/api/v1/auth/token', [
'grant_type' => 'client_credentials',
'client_id' => $clientId,
'client_secret' => $clientSecret,
]);
$accessToken = $tokenResponse['access_token'];
// token valid for 1 hour — cache in b_option
Cost Calculation
$calcResult = $httpClient->post('/api/v1/orders/calc', [
'partnerOrder' => [
'partnerOrderId' => 'SHOP-' . $orderId,
'pvzCode' => $selectedPvzCode,
'dimensions' => [
'length' => $lengthCm,
'width' => $widthCm,
'height' => $heightCm,
'weight' => $weightGram,
],
'assessedValue' => $assessedValue,
],
]);
$deliveryCost = $calcResult['deliveryCost'];
For preliminary calculation (before selecting specific pickup point), can pass town code instead of pickup point code — API returns basic cost by zone.
Pickup Point Loading and Display
Pickup points list is large: over 15,000 objects. Loading strategy:
- Once per day (Bitrix agent) request current list via
GET /api/v1/pvz. - Save to HL-block "5Post Pickup Points" with fields: code, name, address, coordinates, working hours, allowed dimensions.
- On checkout page filter pickup points by selected city and display on map.
Important nuance: 5Post pickup points have dimension restrictions. maxDimensionCm and maxWeightGram must be considered when filtering to not show customer pickup points where their package physically won't fit.
Creating Request
After selecting pickup point and ordering:
$orderPayload = [
'partnerOrder' => [
'partnerOrderId' => 'SHOP-' . $bitrixOrderId,
'pvzCode' => $pvzCode,
'recipientName' => $fullName,
'recipientPhone' => $phone,
'recipientEmail' => $email,
'assessedValue' => $assessedValue,
'cashOnDelivery' => $codAmount,
'dimensions' => $dimensions,
'places' => [
['barcode' => 'SHOP-' . $bitrixOrderId . '-1', 'description' => 'Place 1']
],
],
];
Response contains orderUUID — save to b_sale_order_props. Also returns label for printing (labelUrl): PDF with barcode for sticker on package.
Delivery Statuses
5Post sends webhooks on status change. Register URL in personal account. Status mapping:
| 5Post Status | Bitrix Order Status |
|---|---|
CREATED |
Sent for delivery |
IN_TRANSIT |
In transit |
ARRIVED_AT_PVZ |
Waiting at pickup point |
ISSUED |
Delivered |
RETURNED |
Return |
CANCELED |
Canceled |
Upon receiving webhook, check X-Signature header (HMAC signature) — 5Post signs requests with partner's secret key.
Special Features
5Post doesn't automatically refund unused orders — needs return conditions setup in contract. Storage period at pickup point is 7 days, then package returns. On return, update status in b_sale_order via same webhook mechanism.
Timeline
| Scope | Components | Duration |
|---|---|---|
| Calculation + creating requests | Without PVZ map, address delivery only | 3–4 days |
| + Pickup point map | HL-block + selection widget + dimension filter | +3–4 days |
| + Status webhooks | Handler + mapping | +1–2 days |







