Integrating 1C-Bitrix with the 5Post delivery service

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

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:

  1. Once per day (Bitrix agent) request current list via GET /api/v1/pvz.
  2. Save to HL-block "5Post Pickup Points" with fields: code, name, address, coordinates, working hours, allowed dimensions.
  3. 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