Add Cashbox Handler sale.cashbox.handler.add
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
cashboxWho can execute the method: CRM administrator (permission "Allow changing settings")
The method sale.cashbox.handler.add adds a REST cashbox handler.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
CODE* |
Code of the REST handler. Must be unique among all handlers |
|
NAME* |
Name of the REST handler |
|
SORT |
Sorting. Default value: |
|
SUPPORTS_FFD105 |
Indicates whether the cashbox supports fiscal data format version 1.05. Possible values:
Default value: |
|
SETTINGS* |
Handler settings (detailed description provided below) |
SETTINGS Parameter
Required parameters are marked with *
|
Name |
Description |
|
PRINT_URL* |
Address to which data for printing the receipt is sent |
|
CHECK_URL* |
Address for checking the status of the receipt |
|
HTTP_VERSION |
Version of the HTTP protocol used for requests. Possible values: If the parameter is not filled, HTTP |
|
CONFIG* |
Structure of settings (detailed description provided below), which the user can set and modify on the cashbox editing page, as well as when adding or updating the cashbox via REST. Each key in this parameter defines one section on the settings page, the key is the section code. The values of the object describe the section and the settings contained within it |
SETTINGS[CONFIG] Parameter
Required parameters are marked with *
|
Name |
Description |
|
LABEL* |
Section header |
|
ITEMS* |
List of settings in the section (detailed description provided below). The key is the setting code, the value is the description of the setting |
SETTINGS[CONFIG][section code][ITEMS] Parameter
Required parameters are marked with *
|
Name |
Description |
|
TYPE* |
Type of setting. Possible values:
|
|
LABEL* |
Name of the setting |
|
REQUIRED* |
Indicates whether the setting is required. Possible values:
|
|
DISABLED |
Indicates whether editing of the setting is disabled. Possible values:
Default value: |
|
MULTIPLE |
Indicates whether the setting is multiple. Possible values:
Default value: |
|
MULTILINE |
Indicates whether the field is multiline. Used for
Default value: |
|
OPTIONS* |
List of possible values for the property. Used for The key of the object is the property value, the value of the key is the name of the value displayed in the interface |
|
TIME |
Indicates whether time selection is possible. Used for
Default value: |
Code Examples
How to Use Examples in Documentation
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"CODE":"restcashbox01","NAME":"REST-Cashbox 01","SORT":100,"SUPPORTS_FFD105":"Y","SETTINGS":{"PRINT_URL":"http://example.com/rest_print.php","CHECK_URL":"http://example.com/rest_check.php","HTTP_VERSION":"1.1","CONFIG":{"AUTH":{"LABEL":"Authorization","ITEMS":{"KEYWORD":{"TYPE":"STRING","LABEL":"Password"},"PREFERENCE":{"TYPE":"ENUM","LABEL":"Multiple Choice","REQUIRED":"Y","OPTIONS":{"FIRST":"First","SECOND":"Second","THIRD":"Third"}}}},"INTERACTION":{"LABEL":"Interaction Settings with Cashbox","ITEMS":{"MODE":{"TYPE":"ENUM","LABEL":"Cashbox Operating Mode","OPTIONS":{"ACTIVE":"live","TEST":"test"}}}}}}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/sale.cashbox.handler.add
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"CODE":"restcashbox01","NAME":"REST-Cashbox 01","SORT":100,"SUPPORTS_FFD105":"Y","SETTINGS":{"PRINT_URL":"http://example.com/rest_print.php","CHECK_URL":"http://example.com/rest_check.php","HTTP_VERSION":"1.1","CONFIG":{"AUTH":{"LABEL":"Authorization","ITEMS":{"KEYWORD":{"TYPE":"STRING","LABEL":"Password"},"PREFERENCE":{"TYPE":"ENUM","LABEL":"Multiple Choice","REQUIRED":"Y","OPTIONS":{"FIRST":"First","SECOND":"Second","THIRD":"Third"}}}},"INTERACTION":{"LABEL":"Interaction Settings with Cashbox","ITEMS":{"MODE":{"TYPE":"ENUM","LABEL":"Cashbox Operating Mode","OPTIONS":{"ACTIVE":"live","TEST":"test"}}}}}},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/sale.cashbox.handler.add
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
try {
const response = await $b24.actions.v2.call.make<number>({
method: 'sale.cashbox.handler.add',
params: {
CODE: 'restcashbox01',
NAME: 'REST cashbox 01',
SORT: 100,
SUPPORTS_FFD105: 'Y',
SETTINGS: {
PRINT_URL: 'http://example.com/rest_print.php',
CHECK_URL: 'http://example.com/rest_check.php',
HTTP_VERSION: '1.1',
CONFIG: {
AUTH: {
LABEL: 'Authorization',
ITEMS: {
KEYWORD: {
TYPE: 'STRING',
LABEL: 'Keyword',
},
PREFERENCE: {
TYPE: 'ENUM',
LABEL: 'Multiple choice',
REQUIRED: 'Y',
OPTIONS: {
FIRST: 'First',
SECOND: 'Second',
THIRD: 'Third',
},
},
},
},
INTERACTION: {
LABEL: 'Cash register interaction settings',
ITEMS: {
MODE: {
TYPE: 'ENUM',
LABEL: 'Cash register operating mode',
OPTIONS: {
ACTIVE: 'active',
TEST: 'test',
},
},
},
},
},
},
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('New cashbox handler ID:', result)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function addCashboxHandler() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'sale.cashbox.handler.add',
params: {
CODE: 'restcashbox01',
NAME: 'REST cashbox 01',
SORT: 100,
SUPPORTS_FFD105: 'Y',
SETTINGS: {
PRINT_URL: 'http://example.com/rest_print.php',
CHECK_URL: 'http://example.com/rest_check.php',
HTTP_VERSION: '1.1',
CONFIG: {
AUTH: {
LABEL: 'Authorization',
ITEMS: {
KEYWORD: {
TYPE: 'STRING',
LABEL: 'Keyword',
},
PREFERENCE: {
TYPE: 'ENUM',
LABEL: 'Multiple choice',
REQUIRED: 'Y',
OPTIONS: {
FIRST: 'First',
SECOND: 'Second',
THIRD: 'Third',
},
},
},
},
INTERACTION: {
LABEL: 'Cash register interaction settings',
ITEMS: {
MODE: {
TYPE: 'ENUM',
LABEL: 'Cash register operating mode',
OPTIONS: {
ACTIVE: 'active',
TEST: 'test',
},
},
},
},
},
},
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('New cashbox handler ID:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', addCashboxHandler)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
settings = {
"PRINT_URL": "http://example.com/rest_print.php",
"CHECK_URL": "http://example.com/rest_check.php",
"HTTP_VERSION": "1.1",
"CONFIG": {
"AUTH": {
"LABEL": "Authorization",
"ITEMS": {
"KEYWORD": {
"TYPE": "STRING",
"LABEL": "Code word",
},
"PREFERENCE": {
"TYPE": "ENUM",
"LABEL": "Multiple choice",
"REQUIRED": "Y",
"OPTIONS": {
"FIRST": "First",
"SECOND": "Second",
"THIRD": "Third",
},
},
},
},
"INTERACTION": {
"LABEL": "Cash register interaction settings",
"ITEMS": {
"MODE": {
"TYPE": "ENUM",
"LABEL": "Cash register operating mode",
"OPTIONS": {
"ACTIVE": "production",
"TEST": "test",
},
},
},
},
},
}
try:
bitrix_response = client.sale.cashbox.handler.add(
code="restcashbox01",
name="REST cash register 01",
sort=100,
supports_ffd105=True,
settings=settings,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Bitrix API error",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Bitrix SDK error: {error.message}")
except Exception as error:
print(f"Unexpected error: {error}")
try {
$response = $b24Service
->core
->call(
'sale.cashbox.handler.add',
[
'CODE' => 'restcashbox01',
'NAME' => 'REST-Cashbox 01',
'SORT' => 100,
'SUPPORTS_FFD105' => 'Y',
'SETTINGS' => [
'PRINT_URL' => 'http://example.com/rest_print.php',
'CHECK_URL' => 'http://example.com/rest_check.php',
'HTTP_VERSION' => '1.1',
'CONFIG' => [
'AUTH' => [
'LABEL' => 'Authorization',
'ITEMS' => [
'KEYWORD' => [
'TYPE' => 'STRING',
'LABEL' => 'Password',
],
'PREFERENCE' => [
'TYPE' => 'ENUM',
'LABEL' => 'Multiple Choice',
'REQUIRED' => 'Y',
'OPTIONS' => [
'FIRST' => 'First',
'SECOND' => 'Second',
'THIRD' => 'Third',
],
],
],
],
'INTERACTION' => [
'LABEL' => 'Interaction Settings with Cashbox',
'ITEMS' => [
'MODE' => [
'TYPE' => 'ENUM',
'LABEL' => 'Cashbox Operating Mode',
'OPTIONS' => [
'ACTIVE' => 'live',
'TEST' => 'test',
],
],
],
],
],
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
console.dir($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding cashbox handler: ' . $e->getMessage();
}
BX24.callMethod(
"sale.cashbox.handler.add",
{
"CODE": "restcashbox01",
"NAME": "REST-Cashbox 01",
"SORT": 100,
"SUPPORTS_FFD105": "Y",
"SETTINGS":
{
"PRINT_URL": "http://example.com/rest_print.php",
"CHECK_URL": "http://example.com/rest_check.php",
"HTTP_VERSION": "1.1",
"CONFIG":
{
"AUTH": {
"LABEL": "Authorization",
"ITEMS": {
"KEYWORD": {
"TYPE": "STRING",
"LABEL": "Password"
},
"PREFERENCE": {
"TYPE": "ENUM",
"LABEL": "Multiple Choice",
"REQUIRED": "Y",
"OPTIONS": {
"FIRST": "First",
"SECOND": "Second",
"THIRD": "Third",
}
}
}
},
"INTERACTION": {
"LABEL": "Interaction Settings with Cashbox",
"ITEMS": {
"MODE": {
"TYPE": "ENUM",
"LABEL": "Cashbox Operating Mode",
"OPTIONS": {
"ACTIVE": "live",
"TEST": "test"
}
}
}
}
}
}
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'sale.cashbox.handler.add',
[
'CODE' => 'restcashbox01',
'NAME' => 'REST-Cashbox 01',
'SORT' => 100,
'SUPPORTS_FFD105' => 'Y',
'SETTINGS' =>
[
'PRINT_URL' => 'http://example.com/rest_print.php',
'CHECK_URL' => 'http://example.com/rest_check.php',
'HTTP_VERSION' => '1.1',
'CONFIG' =>
[
'AUTH' =>
[
'LABEL' => 'Authorization',
'ITEMS' =>
[
'KEYWORD' =>
[
'TYPE' => 'STRING',
'LABEL' => 'Password'
],
'PREFERENCE' =>
[
'TYPE' => 'ENUM',
'LABEL' => 'Multiple Choice',
'REQUIRED' => 'Y',
'OPTIONS' =>
[
'FIRST' => 'First',
'SECOND' => 'Second',
'THIRD' => 'Third',
]
]
]
},
'INTERACTION' =>
[
'LABEL' => 'Interaction Settings with Cashbox',
'ITEMS' =>
[
'MODE' =>
[
'TYPE' => 'ENUM',
'LABEL' => 'Cashbox Operating Mode',
'OPTIONS' =>
[
'ACTIVE' => 'live',
'TEST' => 'test'
]
]
]
]
]
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client and ctx are already created — see the Go SDK section
res, err := client.Core().Call(ctx, "sale.cashbox.handler.add", b24.Params{
"CODE": "restcashbox01",
"NAME": "REST-Cashbox 01",
"SORT": 100,
"SUPPORTS_FFD105": "Y",
"SETTINGS": b24.Params{
"PRINT_URL": "http://example.com/rest_print.php",
"CHECK_URL": "http://example.com/rest_check.php",
"HTTP_VERSION": "1.1",
"CONFIG": b24.Params{
"AUTH": b24.Params{
"LABEL": "Authorization",
"ITEMS": b24.Params{
"KEYWORD": b24.Params{
"TYPE": "STRING",
"LABEL": "Password",
},
"PREFERENCE": b24.Params{
"TYPE": "ENUM",
"LABEL": "Multiple Choice",
"REQUIRED": "Y",
"OPTIONS": b24.Params{
"FIRST": "First",
"SECOND": "Second",
"THIRD": "Third",
},
},
},
},
"INTERACTION": b24.Params{
"LABEL": "Interaction Settings with Cashbox",
"ITEMS": b24.Params{
"MODE": b24.Params{
"TYPE": "ENUM",
"LABEL": "Cashbox Operating Mode",
"OPTIONS": b24.Params{
"ACTIVE": "live",
"TEST": "test",
},
},
},
},
},
},
})
if err != nil {
return fmt.Errorf("sale.cashbox.handler.add: %w", err)
}
var newID b24.ID
if err := json.Unmarshal(res.Result, &newID); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println("id:", newID)
Typical use-cases and scenarios
Response Handling
HTTP Status: 200
{
"result": 5,
"time": {
"start": 1712132792.910734,
"finish": 1712132793.530359,
"duration": 0.6196250915527344,
"processing": 0.032338857650756836,
"date_start": "2024-04-03T10:26:32+02:00",
"date_finish": "2024-04-03T10:26:33+02:00",
"operating_reset_at": 1705765533,
"operating": 3.3076241016387939
}
}
Returned Data
|
Name |
Description |
|
result |
Identifier of the created handler |
|
time |
Information about the request execution time |
Error Handling
HTTP Status: 400, 403
{
"error": "ERROR_HANDLER_ALREADY_EXIST",
"error_description": "Handler already exists!"
}
|
Name |
Description |
|
error |
String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Error Codes
|
Code |
Description |
Status |
|
|
Insufficient permissions to add the handler |
403 |
|
|
Required field value is missing or one of the field values is incorrect |
400 |
|
|
A handler with the code specified in the |
400 |
|
|
Other errors. More detailed information about the error can be found in |
400 |
Statuses and System Error Codes
HTTP Status: 4xx, 5xx
The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans. A webhook receives a different error message — |
|
|
|
No active webhook with the specified user identifier and secret code was found |
|
|
|
No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope |
|
|
|
The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
PRINT_URL Page
The PRINT_URL page is the address to which data for printing the receipt is sent.
Example Data Sent to PRINT_URL
{
"type": "sell",
"calculated_sign": "income",
"unique_id": 85,
"items": [
{
"name": "Product",
"base_price": 12000.0,
"price": 9600.0,
"sum": 9600.0,
"currency": "USD",
"quantity": 1,
"measure_code": "796",
"vat": 3,
"vat_sum": 1600.0,
"payment_object": "commodity_marking",
"nomenclature_code": "DM �Yߠ�Q:4H7/3f^7fZ1",
"marking_code": "011390002199781321Q:4H7/3f^7fZ1",
"barcode": "1234567890",
"discount": {
"discount": 2400.0
},
"payment_method": "full_payment"
}
],
"date_create": 1712235417,
"payments": [
{
"type": "cash",
"is_cash": "Y",
"sum": 1000,
"currency": "USD"
}
],
"client_email": "client@example.com",
"client_phone": "+123456789",
"total_sum": 9600.0,
"uuid": "check|example.com|85",
"operation": "income",
"number_kkm": "",
"service_email": "admin@example.com",
"cashbox_params": {
"AUTH": {
"LOGIN": "user123",
"PASSWORD": "top_secret!"
},
"COMPANY": {
"INN": "123"
},
"INTERACTION": {
"MODE": "ACTIVE"
}
}
}
Structure of POST Parameters Sent to PRINT_URL
|
Name |
Description |
|
type |
Type of receipt. Values:
|
|
operation |
Indicator of income/expenditure. Values:
|
|
calculated |
Analogous to |
|
unique_id |
ID of the receipt in the database of the account |
|
items |
Array of products in the receipt (detailed description provided below) |
|
date_create |
Date of receipt creation ( |
|
payments |
Array of payments (detailed description provided below) |
|
client_email |
Client's e-mail (if available) |
|
client_phone |
Client's phone number (if available) |
|
total_sum |
Total amount of the receipt |
|
uuid |
Identifier of the document in the external system (Bitrix24 account) |
|
service_email |
Email (from cashbox settings) |
items Parameter
|
Name |
Description |
|
name |
Name of the product |
|
base_price |
Price of the product without discounts and surcharges |
|
price |
Selling price |
|
sum |
Amount of the item |
|
quantity |
Quantity of the product |
|
vat |
Tax identifier. It can be used in the catalog.vat.get method to obtain information about the tax |
|
vat_sum |
Tax amount |
|
barcode |
Barcode. Used when inventory management is enabled and the product is transferred with a unique barcode |
|
nomenclature_code |
Nomenclature code in binary representation (if available) |
|
marking_code |
Nomenclature code (if available) |
|
payment_object |
Indicator of the payment item. Standard values:
|
|
payment_method |
Indicator of the payment method. Values:
|
|
supplier_info |
Agency details when using agency schemes (detailed description provided below) |
|
discount |
Discount on the product. The key is deprecated and is no longer used. |
supplier_info Parameter
|
Name |
Description |
|
phones |
Phone numbers |
|
name |
Name of the supplier |
|
inn |
Supplier's INN |
payments Parameter
|
Name |
Description |
|
type |
Type of payment. Values:
|
|
is_cash |
Is the payment made in cash ( |
|
sum |
Payment amount |
|
currency |
Payment currency |
CHECK_URL Page
The CHECK_URL page is the address for checking the success of receipt printing.
A request to the CHECK_URL address is made either by the manager's request or automatically after some time following the successful printing of the receipt.
Example Data Sent to CHECK_URL
{
"uuid": "00112233-4455-6677-8899-aabbccddeeff"
}
Structure of POST Parameters Sent to CHECK_URL
|
Name |
Description |
|
uuid |
Identifier of the receipt |
Continue Learning
- Update Cash Register Handler sale.cashbox.handler.update
- Get a list of available cash register handlers sale.cashbox.handler.list
- Delete Cashbox Handler sale.cashbox.handler.delete
- Add Cash Register sale.cashbox.add
- Update Existing Cash Register sale.cashbox.update
- Get a list of configured cash registers sale.cashbox.list
- Delete cash register sale.cashbox.delete
- Save the result of printing the receipt sale.cashbox.check.apply
- How to Connect a Cash Register to Bitrix24