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:
- Get the company of the current user from
b2b_company_users - Read the
b2b_credit_statusrecord for this company - If
UF_BLOCK_ORDERS= true or (UF_USED_AMOUNT+ new order amount) >UF_CREDIT_LIMIT— add error, order is not created - 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.







