Setting up credit limits for 1C-Bitrix B2B clients

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
    1173
  • 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
    745
  • 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

Configuring Credit Limits for B2B Clients in 1C-Bitrix

A credit limit is the maximum amount of unpaid orders that a company can have simultaneously. If the limit is exceeded, new orders are not accepted until the debt is paid off. Without this check in Bitrix, the portal accepts orders even from clients with accumulated debt exceeding the allowable amount.

Where Limit Data Is Stored

Bitrix does not have a built-in credit limit mechanism — this data comes from the accounting system. Data source — 1C. Synchronization via scheme:

1C exports JSON/XML → Bitrix agent reads file or queries REST service → data is written to Highload block b2b_credit_status.

Highload block structure:

Field Description
UF_COMPANY_ID Company ID in Bitrix
UF_1C_COMPANY_ID Counterparty code in 1C
UF_CREDIT_LIMIT Established limit
UF_USED_AMOUNT Used amount (unpaid orders)
UF_OVERDUE_AMOUNT Overdue debt
UF_OVERDUE_DAYS Days overdue
UF_BLOCK_ORDERS Order blocking flag
UF_UPDATED_AT Last sync time

Checking During Order Placement

The OnBeforeSaleOrderAdd event handler:

  1. Get the company of the current user from b2b_company_users
  2. Read the b2b_credit_status record for this company
  3. If UF_BLOCK_ORDERS = true or (UF_USED_AMOUNT + new order amount) > UF_CREDIT_LIMIT — add error, order is not created
  4. Error text: "Credit limit exceeded. Available: X units. Debt: Y units."

For VIP clients with unlimited credit — field UF_CREDIT_LIMIT = 0, in the check we handle as "no restrictions."

Displaying Limit in Cabinet

In the B2B client's personal cabinet, a widget with current limit status: progress bar (used/available), overdue amount if any, data update date. If data was updated more than 12 hours ago — "Data may be outdated" note.

If there is blocking — warning in the header of each cabinet page. The "Place Order" button in cart is replaced with "Contact manager to remove blocking" with a contact link.

Synchronization and Data Relevance

The update agent runs every 2-4 hours via CAgent::AddAgent. Additionally — event trigger: when an order status changes to "Paid" in Bitrix (from 1C via webhook) — force update the client record.

Timelines

Storage setup and checkout check: 1 week. With 1C synchronization and cabinet widget: 2-3 weeks.