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: sale, cashbox

Who can execute the method: CRM administrator (permission "Allow changing settings")

This method adds a REST cashbox handler.

Method Parameters

Required parameters are marked with *

Name
type

Description

CODE*
string

Code of the REST handler. Must be unique among all handlers

NAME*
string

Name of the REST handler

SORT
integer

Sorting. Default value: 100

SUPPORTS_FFD105
string

Indicates whether the cashbox supports fiscal data format version 1.05. Possible values:

  • Y — yes
  • N — no

Default value: N

SETTINGS*
object

Handler settings (detailed description provided below)

SETTINGS Parameter

Required parameters are marked with *

Name
type

Description

PRINT_URL*
string

Address to which data for printing the receipt is sent

CHECK_URL*
string

Address for checking the status of the receipt

HTTP_VERSION
string

Version of the HTTP protocol used for requests. Possible values: 1.0, 1.1.

If the parameter is not filled, HTTP 1.0 is used for requests

CONFIG*
object

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
type

Description

LABEL*
string

Section header

ITEMS*
object

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
type

Description

TYPE*
string

Type of setting. Possible values:

  • STRING — string
  • NUMBER — floating point number
  • Y/N — string accepting values Y or N
  • ENUM — list of string values
  • DATE — date

LABEL*
string

Name of the setting

REQUIRED*
string

Indicates whether the setting is required. Possible values:

  • Y — yes
  • N — no

DISABLED
string

Indicates whether editing of the setting is disabled. Possible values:

  • Y — yes
  • N — no

Default value: N

MULTIPLE
string

Indicates whether the setting is multiple. Possible values:

  • Y — yes
  • N — no

Default value: N

MULTILINE
string

Indicates whether the field is multiline. Used for STRING type. Possible values:

  • Y — yes
  • N — no

Default value: N

OPTIONS*
object

List of possible values for the property. Used for ENUM type.

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
string

Indicates whether time selection is possible. Used for DATE type. Possible values:

  • Y — yes
  • N — no

Default value: N

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
        
try
        {
        	const response = await $b24.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"
        								}
        							}
        						}
        					}
        				}
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.dir(result);
        }
        catch(error)
        {
        	console.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>';
        

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
type

Description

result
sale_cashbox_handler.ID

Identifier of the created handler

time
time

Information about the request execution time

Error Handling

HTTP Status: 400, 403

{
            "error": "ERROR_HANDLER_ALREADY_EXIST",
            "error_description": "Handler already exists!"
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Possible Error Codes

Code

Description

Status

ACCESS_DENIED

Insufficient permissions to add the handler

403

ERROR_CHECK_FAILURE

Required field value is missing or one of the field values is incorrect

400

ERROR_HANDLER_ALREADY_EXIST

A handler with the code specified in the CODE parameter already exists in the system

400

ERROR_HANDLER_ADD

Other errors. More detailed information about the error can be found in error_description

400

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not permitted for calls using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The HTTPS protocol is required for method calls

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block; please contact Bitrix24 technical support to lift it

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is only available on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user associated with the access token or webhook used to call the method lacks the necessary permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the portal administrator has restricted access to this application to specific users only

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site 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

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
type

Description

type
string

Type of receipt. Values:

  • sell — full payment
  • sellreturncash — full cash return
  • sellreturn — full non-cash return
  • advancepayment — advance payment
  • advancereturn — return of advance payment non-cash
  • advancereturncash — return of advance payment cash
  • creditpayment — credit payment
  • creditpaymentreturn — return of credit payment non-cash
  • creditpaymentreturncash — return of credit payment cash
  • credit — purchase on credit
  • creditreturn — return of purchase on credit
  • prepayment — partial advance payment
  • prepaymentreturn — return of partial advance payment non-cash
  • prepaymentreturncash — return of partial advance payment cash
  • fullprepayment — 100% advance payment
  • fullprepaymentreturn — return of 100% advance payment non-cash
  • fullprepaymentreturncash — return of 100% advance payment cash

operation
string

Indicator of income/expenditure. Values:

  • income — income
  • consumption — expenditure

calculated
string

Analogous to operation (for compatibility)

unique_id
integer

ID of the receipt in the database of the account

items
object

Array of products in the receipt (detailed description provided below)

date_create
integer

Date of receipt creation (timestamp)

payments
object

Array of payments (detailed description provided below)

client_email
string

Client's e-mail (if available)

client_phone
string

Client's phone number (if available)

total_sum
float

Total amount of the receipt

uuid
string

Identifier of the document in the external system (Bitrix24 account)

service_email
string

Email (from cashbox settings)

items Parameter

Name
type

Description

name
string

Name of the product

base_price
float

Price of the product without discounts and surcharges

price
float

Selling price

sum
float

Amount of the item

quantity
float

Quantity of the product

vat
int

Tax identifier. It can be used in the catalog.vat.get method to obtain information about the tax

vat_sum
float

Tax amount

barcode
string

Barcode. Used when inventory management is enabled and the product is transferred with a unique barcode

nomenclature_code
string

Nomenclature code in binary representation (if available)

marking_code
string

Nomenclature code (if available)

payment_object
string

Indicator of the payment item. Standard values:

  • commodity — product
  • commodity_marking — product subject to marking and having a marking code
  • service — service
  • payment — payment

payment_method
string

Indicator of the payment method. Values:

  • full_payment — full payment
  • advance — advance
  • prepayment — prepayment
  • full_prepayment — 100% prepayment
  • credit — purchase on credit
  • credit_payment — credit payment

supplier_info
array

Agency details when using agency schemes (detailed description provided below)

discount
array

Discount on the product. The key is deprecated and is no longer used.
The array transmits the parameter discount (float) — the size of the discount in monetary terms

supplier_info Parameter

Name
type

Description

phones
string[]

Phone numbers

name
string

Name of the supplier

inn
string

Supplier's INN

payments Parameter

Name
type

Description

type
string

Type of payment. Values:

  • cash — cash payment
  • cashless — non-cash payment

is_cash
string

Is the payment made in cash (Y/N). The key is deprecated, it is recommended to use type instead

sum
float

Payment amount

currency
string

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
type

Description

uuid
string

Identifier of the receipt

Continue Learning