Setting up a connection between an online store and a 1C-Bitrix offline cash register

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
    1212
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815
  • 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
    565
  • 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
    657
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    980

Configuring Integration of Online Store and Offline Cashbox 1С-Bitrix

Customer places an order online and selects "pay on delivery". Courier delivers the order and prints a check on a mobile cashbox. The fiscal receipt is issued, but in Bitrix the order is still in "awaiting payment" status. Warehouse did not deduct items, accounting does not see the payment. Integration of online store with offline cashbox is not just about fiscalization, but also about order state synchronization.

Payment fiscalization scheme

According to 54-FZ, every settlement fact must be accompanied by a receipt. In Bitrix, the salescenter module and bitrix:salescenter.cashbox component implement integration with online cashboxes via OFD. For offline cashbox, the scheme is different: the receipt is issued by the cashbox device (АТОЛ, Эвотор, Штрих-М), and Bitrix must learn about this fact.

Two directions of data:

  1. Bitrix → cashbox: order data (items, amounts, VAT) for receipt formation
  2. Cashbox → Bitrix: receipt processing confirmation with number and fiscal mark

Integration via cashbox software API

Most modern cashbox systems have REST API or webhook. Эвотор provides Cloud API, АТОЛ has its own API for cloud cashbox.

On Bitrix side, when order status changes (e.g., "delivered to courier"):

AddEventHandler('sale', 'OnSaleStatusOrderChange', function(\Bitrix\Main\Event $event) {
    $order  = $event->getParameter('ENTITY');
    $status = $order->getField('STATUS_ID');

    if ($status !== 'DE') { // 'DE' = delivered, per your status scheme
        return;
    }

    // Prepare cashbox data
    $items = [];
    foreach ($order->getBasket() as $item) {
        $items[] = [
            'name'     => $item->getField('NAME'),
            'quantity' => $item->getQuantity(),
            'price'    => $item->getPrice(),
            'vat'      => getVatTag($item->getField('VAT_RATE')),
        ];
    }

    // Send to cashbox system (example for Эвотор)
    $evotorApi->sendReceipt($order->getId(), $items, $order->getPrice());
});

Receiving confirmation from cashbox

Cashbox sends webhook on successful receipt processing. Endpoint in Bitrix:

// /local/ajax/cashbox-callback.php
$data = json_decode(file_get_contents('php://input'), true);

if ($data['event'] === 'receipt.created') {
    $orderId    = $data['external_id'];
    $fiscalSign = $data['fiscal_document_number'];

    $order = \Bitrix\Sale\Order::load($orderId);
    if ($order) {
        // Fix payment
        $payment = $order->getPaymentCollection()->current();
        $payment->setField('PAID', 'Y');
        $payment->setField('EXTERNAL_PAYMENT', $fiscalSign);

        // Move order to correct status
        $order->setField('STATUS_ID', 'F'); // Finalized
        $order->save();
    }
}

Inventory synchronization

Offline cashbox sale without binding to online order — for example, someone bought something in store that was simultaneously awaited for online order — should decrease inventory in b_catalog_product or b_catalog_store_product.

Two approaches:

  • Via 1C: 1C accounts for all sales (online + offline) and synchronizes inventory in Bitrix by schedule
  • Direct cashbox integration with Bitrix: cashbox calls Bitrix API on each sale to deduct inventory via CCatalogProduct::Update() or REST API catalog.product.update

VAT and rate tag

Error in VAT rate when sending to cashbox is violation of 54-FZ. VAT rates in Bitrix are stored in b_catalog_vat and b_sale_tax. When preparing receipt data, mapping is:

  • VAT_RATE = 20 → tag 1105 (VAT 20%)
  • VAT_RATE = 10 → tag 1104 (VAT 10%)
  • VAT_RATE = 0 → tag 1106 (VAT 0%)
  • VAT_INCLUDE = N (no VAT) → tag 1107

What we configure

  • OnSaleStatusOrderChange handler to send data to cashbox system
  • Webhook-endpoint to receive fiscalization confirmation
  • Mapping of VAT rates between Bitrix and cashbox system
  • Updating payment status and fiscal mark field in b_sale_payment
  • Inventory synchronization mechanism for offline sales
  • Logging of all cashbox API calls for diagnostics