### Get Receipt Status (Python) Source: https://api.digitalkassa.ru/v2.1/doc/index Python example for fetching the status of a fiscal receipt. It utilizes the `requests` library to send a GET request with appropriate headers for authentication and content type. ```python import requests url = "https://api.digitalkassa.ru/v2.1/c_groups/1/receipts/db2ea217075c4880b67f0477f4524859" headers = { "Authorization": "Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr", "Content-Type": "application/json; charset=utf-8" } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Get Receipt Status (PHP) Source: https://api.digitalkassa.ru/v2.1/doc/index Example of how to retrieve the status of a fiscal receipt using PHP. This snippet demonstrates making an HTTP GET request with necessary headers for authentication and content type. ```php "https://api.digitalkassa.ru/v2.1/c_groups/1/receipts/db2ea217075c4880b67f0477f4524859", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Authorization: Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr", "Content-Type: application/json; charset=utf-8" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:". $err; } else { echo $response; } ``` -------------------------------- ### Get Receipt Status (Go) Source: https://api.digitalkassa.ru/v2.1/doc/index Go language implementation for retrieving a fiscal receipt's status. This code snippet shows how to set up an HTTP client, create a GET request with custom headers, and process the response. ```go package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func main() { url := "https://api.digitalkassa.ru/v2.1/c_groups/1/receipts/db2ea217075c4880b67f0477f4524859" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Authorization", "Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr") req.Header.Add("Content-Type", "application/json; charset=utf-8") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Python Example for Creating a Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index Shows how to create a receipt using Python's `requests` library. It constructs the JSON payload and sends a POST request to the API. Error handling for the request is included. ```python import requests import json url = "https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts" data = { "type": 1, "items": [ { "type": 0, "name": "string", "price": 42949672.95, "quantity": 0.001, "amount": 42949672.95, "unit": 0, "payment_method": 1, "vat": 1, "excise": 0.01, "barcode": "string", "additional_props": "string", "declaration_number": "string", "country_code": "str", "marking": { "code": "string", "item_status": 1, "numerator": 0, "denominator": 0 }, "agent": { "type": 1, "supplier": { "phones": [ "string" ], "name": "string", "tin": "stringstri" }, "paying_agent": { "phones": [ "string" ], "operation": "string" }, "money_transfer_operator": { "phones": [ "string" ], "name": "string", "tin": "stringstri", "address": "string" } } } ], "taxation": 1, "is_internet": 0, "timezone": 0, "amount": { "cash": 42949672.95, "cashless": 42949672.95, "prepayment": 42949672.95, "postpayment": 42949672.95, "barter": 42949672.95 }, "cashless_payments": { "payment_sum": 0.01, "payment_method_flag": 255, "payment_identifiers": "string", "additional_info": "string" }, "notify": { "emails": [ "user@example.com" ], "phone": "string" }, "customer": { "tin": "stringstri", "name": "string" }, "additional_attribute": { "name": "string", "value": "string" }, "cashier": { "tin": "stringstri", "name": "string" }, "service": { "callback_url": "string" }, "loc": { "billing_place": "string", "device_number": "string" } } headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic ' } try: response = requests.post(url, headers=headers, data=json.dumps(data)) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Go Example for Creating a Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index Provides a Go program to create a receipt. It defines the request structure, marshals it to JSON, and sends a POST request using the `net/http` package. Includes error handling. ```go package main import ( "bytes" "encoding/base64" "encoding/json" "fmt" "net/http" ) func main() { url := "https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts" receiptData := map[string]interface{}{ "type": 1, "items": []map[string]interface{}{ { "type": 0, "name": "string", "price": 42949672.95, "quantity": 0.001, "amount": 42949672.95, "unit": 0, "payment_method": 1, "vat": 1, "excise": 0.01, "barcode": "string", "additional_props": "string", "declaration_number": "string", "country_code": "str", "marking": map[string]interface{}{ "code": "string", "item_status": 1, "numerator": 0, "denominator": 0 }, "agent": map[string]interface{}{ "type": 1, "supplier": map[string]interface{}{ "phones": []string{"string"}, "name": "string", "tin": "stringstri" }, "paying_agent": map[string]interface{}{ "phones": []string{"string"}, "operation": "string" }, "money_transfer_operator": map[string]interface{}{ "phones": []string{"string"}, "name": "string", "tin": "stringstri", "address": "string" } } } }, "taxation": 1, "is_internet": 0, "timezone": 0, "amount": map[string]interface{}{ "cash": 42949672.95, "cashless": 42949672.95, "prepayment": 42949672.95, "postpayment": 42949672.95, "barter": 42949672.95 }, "cashless_payments": map[string]interface{}{ "payment_sum": 0.01, "payment_method_flag": 255, "payment_identifiers": "string", "additional_info": "string" }, "notify": map[string]interface{}{ "emails": []string{"user@example.com"}, "phone": "string" }, "customer": map[string]interface{}{ "tin": "stringstri", "name": "string" }, "additional_attribute": map[string]interface{}{ "name": "string", "value": "string" }, "cashier": map[string]interface{}{ "tin": "stringstri", "name": "string" }, "service": map[string]interface{}{ "callback_url": "string" }, "loc": map[string]interface{}{ "billing_place": "string", "device_number": "string" } } jsonData, err := json.Marshal(receiptData) if err != nil { fmt.Println("Error marshaling JSON:", err) return } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return } // Replace with your actual login and password auth := base64.StdEncoding.EncodeToString([]byte("login:password")) req.Header.Set("Authorization", "Basic "+auth) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() var result map[string]interface{} err = json.NewDecoder(resp.Body).Decode(&result) if err != nil { fmt.Println("Error decoding response:", err) return } fmt.Println(result) } ``` -------------------------------- ### PHP Example for Creating a Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index Illustrates how to create a receipt using PHP. It involves constructing the JSON payload and sending a POST request to the API endpoint. Ensure you have the necessary cURL extensions enabled. ```php 1, "items" => [ [ "type" => 0, "name" => "string", "price" => 42949672.95, "quantity" => 0.001, "amount" => 42949672.95, "unit" => 0, "payment_method" => 1, "vat" => 1, "excise" => 0.01, "barcode" => "string", "additional_props" => "string", "declaration_number" => "string", "country_code" => "str", "marking" => [ "code" => "string", "item_status" => 1, "numerator" => 0, "denominator" => 0 ], "agent" => [ "type" => 1, "supplier" => [ "phones" => [ "string" ], "name" => "string", "tin" => "stringstri" ], "paying_agent" => [ "phones" => [ "string" ], "operation" => "string" ], "money_transfer_operator" => [ "phones" => [ "string" ], "name" => "string", "tin" => "stringstri", "address" => "string" ] ] ] ], "taxation" => 1, "is_internet" => 0, "timezone" => 0, "amount" => [ "cash" => 42949672.95, "cashless" => 42949672.95, "prepayment" => 42949672.95, "postpayment" => 42949672.95, "barter" => 42949672.95 ], "cashless_payments" => [ "payment_sum" => 0.01, "payment_method_flag" => 255, "payment_identifiers" => "string", "additional_info" => "string" ], "notify" => [ "emails" => [ "user@example.com" ], "phone" => "string" ], "customer" => [ "tin" => "stringstri", "name" => "string" ], "additional_attribute" => [ "name" => "string", "value" => "string" ], "cashier" => [ "tin" => "stringstri", "name" => "string" ], "service" => [ "callback_url" => "string" ], "loc" => [ "billing_place" => "string", "device_number" => "string" ] ]; $ch = curl_init('https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Authorization: Basic ' . base64_encode('login:password') // Replace with your actual credentials ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } c_lose($ch); echo $response; ?> ``` -------------------------------- ### Get Cash Register Group Information (Go) Source: https://api.digitalkassa.ru/v2.1/doc/index This Go code snippet demonstrates fetching cash register group details. It constructs an HTTP GET request with the necessary headers and sends it to the API endpoint. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.digitalkassa.ru/v2.1/c_groups/1", nil) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json; charset=utf-8") req.Header.Add("Authorization", "Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get Cash Register Group Information (Python) Source: https://api.digitalkassa.ru/v2.1/doc/index This Python snippet illustrates how to obtain cash register group information. It uses the `requests` library to send a GET request with the required headers. ```python import requests url = "https://api.digitalkassa.ru/v2.1/c_groups/1" headers = { 'Content-Type': 'application/json; charset=utf-8', 'Authorization': 'Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr' } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### cURL Example for Creating a Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index Demonstrates how to send a POST request to create a receipt using cURL. It includes the endpoint URL, content type, and authorization headers. The request body is sent as JSON. ```bash curl -X POST \ https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic ' -d '{ "type": 1, "items": [ { "type": 0, "name": "string", "price": 42949672.95, "quantity": 0.001, "amount": 42949672.95, "unit": 0, "payment_method": 1, "vat": 1, "excise": 0.01, "barcode": "string", "additional_props": "string", "declaration_number": "string", "country_code": "str", "marking": { "code": "string", "item_status": 1, "numerator": 0, "denominator": 0 }, "agent": { "type": 1, "supplier": { "phones": [ "string" ], "name": "string", "tin": "stringstri" }, "paying_agent": { "phones": [ "string" ], "operation": "string" }, "money_transfer_operator": { "phones": [ "string" ], "name": "string", "tin": "stringstri", "address": "string" } } } ], "taxation": 1, "is_internet": 0, "timezone": 0, "amount": { "cash": 42949672.95, "cashless": 42949672.95, "prepayment": 42949672.95, "postpayment": 42949672.95, "barter": 42949672.95 }, "cashless_payments": { "payment_sum": 0.01, "payment_method_flag": 255, "payment_identifiers": "string", "additional_info": "string" }, "notify": { "emails": [ "user@example.com" ], "phone": "string" }, "customer": { "tin": "stringstri", "name": "string" }, "additional_attribute": { "name": "string", "value": "string" }, "cashier": { "tin": "stringstri", "name": "string" }, "service": { "callback_url": "string" }, "loc": { "billing_place": "string", "device_number": "string" } }' ``` -------------------------------- ### Get Shift Report (GET) Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the report for a specific cash register shift. Requires Basic Authentication. Returns a JSON object with shift status, number, check number, and mode. Handles various error codes for invalid authentication, inactive groups, or server issues. ```http GET /v2.1/c_groups/{c_group_id}/shifts/report HTTP/1.1 Host: api.digitalkassa.ru Authorization: Basic ``` -------------------------------- ### Request Correction Receipt - cURL Source: https://api.digitalkassa.ru/v2.1/doc/index Example of how to request a correction receipt using cURL. It includes necessary headers for content type and authorization, and the endpoint URL with a receipt ID. ```cURL curl \ -H 'Content-Type: application/json; charset=utf-8' \ -H 'Authorization:Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr' \ https://api.digitalkassa.ru/v2.1/c_groups/1/receipts/correction/db2ea217075c4880b67f0477f4524859 ``` -------------------------------- ### Get Receipt Status (cURL) Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the status of a fiscal receipt using its unique ID. Requires Basic Authentication. The request specifies the content type and authorization token. ```curl curl \ -H 'Content-Type: application/json; charset=utf-8' \ -H 'Authorization:Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr' \ https://api.digitalkassa.ru/v2.1/c_groups/1/receipts/db2ea217075c4880b67f0477f4524859 ``` -------------------------------- ### Get Cash Register Group Information (PHP) Source: https://api.digitalkassa.ru/v2.1/doc/index This snippet shows how to fetch details of a cash register group using PHP. It utilizes cURL to make the HTTP request, setting the appropriate headers and URL. ```php ``` -------------------------------- ### Get Cash Register Group Information (cURL) Source: https://api.digitalkassa.ru/v2.1/doc/index This snippet demonstrates how to retrieve information about a specific cash register group using a cURL request. It requires the group ID and includes necessary headers for content type and authorization. ```shell curl \ -H 'Content-Type: application/json; charset=utf-8' \ -H 'Authorization:Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr' \ https://api.digitalkassa.ru/v2.1/c_groups/1 ``` -------------------------------- ### POST /websites/api_digitalkassa_ru_v2_1_doc Source: https://api.digitalkassa.ru/v2.1/doc/index This endpoint allows for the creation of financial transactions, such as sales and refunds, with detailed itemization and taxation information. ```APIDOC ## POST /websites/api_digitalkassa_ru_v2_1_doc ### Description This endpoint is used to create financial transactions, including sales, returns of sales, expenses, and returns of expenses. It requires detailed information about the transaction type, items, taxation system, and settlement details. ### Method POST ### Endpoint /websites/api_digitalkassa_ru_v2_1_doc ### Parameters #### Request Body - **type** (integer) - Required - Enum: 1, 2, 3, 4. Represents the transaction type: 1 - Income (sale), 2 - Return of income, 3 - Expense, 4 - Return of expense. - **items** (Array of objects) - Required - A list of items included in the transaction. - **taxation** (integer) - Required - Enum: 1, 2, 4, 16, 32. Represents the taxation system: 1 - OSN, 2 - USN income, 4 - USN income-expense, 16 - ESN, 32 - PSN. - **is_internet** (integer) - Required - Enum: 0, 1. Indicates if the transaction is related to online sales: 0 - not used for internet sales, 1 - used for internet sales. - **timezone** (integer) - Required - Represents the timezone of the settlement location. Refer to the API documentation for a detailed list of timezone codes. - **amount** (object) - Required - The total amount of the transaction. This should match the sum of amounts for individual items. ### Request Example ```json { "type": 1, "items": [ { "name": "Example Item", "price": 100.00, "quantity": 1, "amount": 100.00, "tax_rate": 20 } ], "taxation": 2, "is_internet": 0, "timezone": 2, "amount": { "value": 100.00, "currency": "RUB" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message confirming the transaction creation. #### Response Example ```json { "status": "success", "message": "Transaction created successfully." } ``` ``` -------------------------------- ### GET /c_groups/{c_group_id}/shifts/report Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the parameters of a cash register shift. A shift is the period between opening and closing reports, not exceeding 24 hours. ```APIDOC ## GET /c_groups/{c_group_id}/shifts/report ### Description Retrieves the parameters of a cash register shift. A shift is the period between opening and closing reports, not exceeding 24 hours. ### Method GET ### Endpoint `https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/shifts/report` ### Parameters #### Path Parameters - **c_group_id** (integer) - Required - The ID of the cash group. ### Responses #### Success Response (200) - **shift_status** (integer) - The status of the shift. - **shift_number** (integer) - The number of the shift. - **check_number** (integer) - The number of the check. - **mode** (integer) - The current shift mode (0 for automatic, 1 for manual). #### Response Example (200) ```json { "shift_status": 0, "shift_number": 73, "check_number": 0, "mode": 0 } ``` #### Error Responses - **400**: System error. - **401**: Invalid `actor_id` or `actor_token`, or authorization header is missing or malformed. - **402**: Cash group or company is inactive; payment is required. - **403**: The actor making the request is deactivated. - **500/503**: Internal server error, please try again. ``` -------------------------------- ### POST /websites/api_digitalkassa_ru_v2_1_doc Source: https://api.digitalkassa.ru/v2.1/doc/index This endpoint allows for the creation of a new transaction record. It requires detailed information about the transaction type, items, taxation, payment methods, and customer details. ```APIDOC ## POST /websites/api_digitalkassa_ru_v2_1_doc ### Description This endpoint allows for the creation of a new transaction record. It requires detailed information about the transaction type, items, taxation, payment methods, and customer details. ### Method POST ### Endpoint /websites/api_digitalkassa_ru_v2_1_doc ### Parameters #### Request Body - **type** (integer) - Required - Enum: 1, 2, 3, 4. Represents the transaction type (e.g., 1 for Sale, 2 for Return of Income). - **items** (Array of objects) - Required - A list of items included in the transaction. - **taxation** (integer) - Required - Enum: 1, 2, 4, 16, 32. Represents the taxation system used for the transaction. - **is_internet** (integer) - Required - Enum: 0, 1. Indicates if the transaction is related to online sales (0 for no, 1 for yes). - **timezone** (integer) - Required - Represents the timezone of the calculation location. - **amount** (object) - Required - Contains the total amount of the transaction. - **cashless_payments** (object) - Optional - Details about cashless payments made for the transaction. - **notify** (object) - Required - Contains contact information (email or phone) for sending transaction notifications. - **customer** (object) - Optional - Information about the customer, including TIN and name if the customer is a legal entity. ### Request Example ```json { "type": 1, "items": [ { "name": "Product A", "price": 100.00, "quantity": 2, "amount": 200.00, "tax_id": 1 } ], "taxation": 2, "is_internet": 0, "timezone": 2, "amount": { "value": 200.00, "currency": "RUB" }, "notify": { "emails": ["customer@example.com"] }, "customer": { "tin": "1234567890", "name": "Customer Name" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success status of the operation. - **ticket_id** (string) - The unique identifier for the created ticket. #### Response Example ```json { "status": "success", "ticket_id": "TICKET123456789" } ``` ``` -------------------------------- ### GET /c_groups/{c_group_id} Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves information about a specific cash register group. This is often a prerequisite for other operations to understand the group's configuration and capabilities. ```APIDOC ## GET /c_groups/{c_group_id} ### Description Retrieves information about a specific cash register group. This is often a prerequisite for other operations to understand the group's configuration and capabilities. ### Method GET ### Endpoint /c_groups/{c_group_id} ### Parameters #### Path Parameters - **c_group_id** (integer) - Required - The unique identifier of the cash register group. #### Query Parameters None #### Request Body None ### Request Example ```curl curl \ -H 'Content-Type: application/json; charset=utf-8' \ -H 'Authorization:Basic MTIzNDU2NzpnbUZqeVFnNXpHODhnQnQzb3k0MXFRUHdr' \ https://api.digitalkassa.ru/v2.1/c_groups/1 ``` ### Response #### Success Response (200) - **type** (string) - The type of the cash register group (e.g., "online_store"). - **taxation** (integer) - The taxation system applied to the group. - **billing_place_list** (array of strings) - A list of billing URLs associated with the group. #### Response Example ```json { "type": "online_store", "taxation": 2, "billing_place_list": [ "https://example.com/" ] } ``` #### Error Responses - **401**: Unauthorized. Invalid actor_id or actor_token, or missing/invalid Authorization header. - **402**: Payment Required. The cash register group or company is inactive. - **403**: Forbidden. The actor making the request is deactivated. - **404**: Not Found. The specified cash register group does not exist or is not accessible to the actor. - **500**: Internal Server Error. Please try again. - **503**: Internal Server Error. Please try again. ``` -------------------------------- ### Get Receipt Status Endpoint Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the status of a previously created cash receipt. This endpoint is useful for confirming if a receipt has been processed successfully. It requires the `c_group_id` and `receipt_id` in the URL. ```http GET /v2.1/c_groups/{c_group_id}/receipts/{receipt_id} HTTP/1.1 Host: api.digitalkassa.ru Authorization: Basic ``` -------------------------------- ### Open Shift (POST) Source: https://api.digitalkassa.ru/v2.1/doc/index Opens a new cash register shift. Supports optional request body parameters like cashier's name, TIN, and address. Requires Basic Authentication. Returns shift details upon successful opening or error codes for invalid requests or server issues. ```http POST /v2.1/c_groups/{c_group_id}/shifts/open HTTP/1.1 Host: api.digitalkassa.ru Authorization: Basic Content-Type: application/json { "name": "string", "tin": "stringstring", "address": "string", "place": "string" } ``` -------------------------------- ### Go Request for Correction Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index This Go code snippet demonstrates how to make a POST request to the Digitalkassa API for creating a correction receipt. It utilizes the 'net/http' package to construct and send the request with the appropriate headers and JSON body. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { url := "https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts/correction/{receipt_id}" data := map[string]interface{}{ // ... your JSON payload data ... } jsonBody, err := json.Marshal(data) if err != nil { fmt.Printf("Error marshaling JSON: %s\n", err) return } resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonBody)) if err != nil { fmt.Printf("Error making request: %s\n", err) return } defer resp.Body.Close() // Process response body here fmt.Printf("Status Code: %d\n", resp.StatusCode) } ``` -------------------------------- ### Get Correction Receipt Status Endpoint Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the status of a correction receipt. This is used for receipts issued to correct previous transactions. The endpoint requires `c_group_id` and `receipt_id` for identification. ```http GET /v2.1/c_groups/{c_group_id}/receipts/correction/{receipt_id} HTTP/1.1 Host: api.digitalkassa.ru Authorization: Basic ``` -------------------------------- ### POST /c_groups/{c_group_id}/shifts/open Source: https://api.digitalkassa.ru/v2.1/doc/index Opens a new cash register shift. This can be done in manual mode. ```APIDOC ## POST /c_groups/{c_group_id}/shifts/open ### Description Opens a new cash register shift. This can be done in manual mode. ### Method POST ### Endpoint `https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/shifts/open` ### Parameters #### Path Parameters - **c_group_id** (integer) - Required - The ID of the cash group. #### Request Body - **name** (string, optional, max 64 characters) - Full name of the cashier. - **tin** (string, optional, exactly 12 characters) - Taxpayer Identification Number (TIN) of the cashier. - **address** (string, optional, max 256 characters) - Address for fiscal document generation. - **place** (string, optional, max 256 characters) - Place for fiscal document generation. ### Request Example (Payload) ```json { "name": "string", "tin": "stringstring", "address": "string", "place": "string" } ``` ### Responses #### Success Response (200) - **shift_number** (integer) - The number of the opened shift. - **fd_number** (integer) - The number of the fiscal document. - **fiscal_sign** (integer) - The fiscal sign. #### Response Example (200) ```json { "shift_number": 1, "fd_number": 2, "fiscal_sign": 3 } ``` #### Error Responses - **400**: System error. - **401**: Invalid `actor_id` or `actor_token`, or authorization header is missing or malformed. - **402**: Cash group or company is inactive; payment is required. - **403**: The actor making the request is deactivated. - **500/503**: Internal server error, please try again. ``` -------------------------------- ### Create Cash Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index Creates a new fiscal cash receipt. This endpoint is used to register a purchase of goods or services, generating a fiscal document with all necessary details. ```APIDOC ## POST /c_groups/{c_group_id}/receipts ### Description Creates a fiscal cash receipt. A cash receipt is a fiscal document that records the fact of a purchase of goods or services. It is created using point-of-sale terminals and includes information about the purchase and seller details. ### Method POST ### Endpoint `https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts` ### Parameters #### Path Parameters - **c_group_id** (integer) - Required - The ID of the cash register group. #### Request Body - **receipt_id** (string) - Required - <= 64 characters. Receipt identifier. Can contain digits and Latin letters. Each receipt creation request must contain a unique `id`. *Note: The request body structure for creating a receipt is not fully detailed in the provided text, but the `receipt_id` is specified as a required parameter.* ``` -------------------------------- ### Create Receipt Request Payload Source: https://api.digitalkassa.ru/v2.1/doc/index Defines the structure for a receipt creation request. It includes item details, taxation information, payment methods, customer information, and optional fields like additional attributes and cashier details. The payload is sent as JSON. ```json { "type": 1, "items": [ { "type": 0, "name": "string", "price": 42949672.95, "quantity": 0.001, "amount": 42949672.95, "unit": 0, "payment_method": 1, "vat": 1, "excise": 0.01, "barcode": "string", "additional_props": "string", "declaration_number": "string", "country_code": "str", "marking": { "code": "string", "item_status": 1, "numerator": 0, "denominator": 0 }, "agent": { "type": 1, "supplier": { "phones": [ "string" ], "name": "string", "tin": "stringstri" }, "paying_agent": { "phones": [ "string" ], "operation": "string" }, "money_transfer_operator": { "phones": [ "string" ], "name": "string", "tin": "stringstri", "address": "string" } } } ], "taxation": 1, "is_internet": 0, "timezone": 0, "amount": { "cash": 42949672.95, "cashless": 42949672.95, "prepayment": 42949672.95, "postpayment": 42949672.95, "barter": 42949672.95 }, "cashless_payments": { "payment_sum": 0.01, "payment_method_flag": 255, "payment_identifiers": "string", "additional_info": "string" }, "notify": { "emails": [ "user@example.com" ], "phone": "string" }, "customer": { "tin": "stringstri", "name": "string" }, "additional_attribute": { "name": "string", "value": "string" }, "cashier": { "tin": "stringstri", "name": "string" }, "service": { "callback_url": "string" }, "loc": { "billing_place": "string", "device_number": "string" } } ``` -------------------------------- ### Cash Register Group Information Response (JSON) Source: https://api.digitalkassa.ru/v2.1/doc/index This is a sample JSON response for a successful request to retrieve information about a cash register group. It includes details like the group type, taxation system, and billing place list. ```json { "type": "online_store", "taxation": 2, "billing_place_list": [ "https://example.com/" ] } ``` -------------------------------- ### Python Request for Correction Receipt Source: https://api.digitalkassa.ru/v2.1/doc/index This Python code snippet shows how to send a POST request to the Digitalkassa API to create a correction receipt using the 'requests' library. It includes the endpoint, headers, and the JSON payload. ```python import requests import json url = "https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts/correction/{receipt_id}" data = { # ... your JSON payload data ... } headers = { "Content-Type": "application/json" } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json()) ``` -------------------------------- ### GET /c_groups/{c_group_id}/receipts/correction/{receipt_id} Source: https://api.digitalkassa.ru/v2.1/doc/index Retrieves the status of a correction receipt. A correction receipt is used to adjust previously made calculations and inform tax authorities of any violations in the use of cash register equipment. ```APIDOC ## GET /c_groups/{c_group_id}/receipts/correction/{receipt_id} ### Description Retrieves the status of a correction receipt. A correction receipt is used to adjust previously made calculations and inform tax authorities of any violations in the use of cash register equipment. ### Method GET ### Endpoint https://api.digitalkassa.ru/v2.1/c_groups/{c_group_id}/receipts/correction/{receipt_id} ### Parameters #### Path Parameters - **c_group_id** (string) - Required - The ID of the cash group. - **receipt_id** (string) - Required - The ID of the correction receipt. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **doc** (object) - Document details. - **reg_time** (string) - Registration time. - **shift_num** (integer) - Shift number. - **index** (integer) - Document index. - **fiscal_sign** (integer) - Fiscal sign. - **fiscal_num** (integer) - Fiscal number. - **cashbox** (object) - Cashbox details. - **rn** (string) - Cashbox registration number. - **ffd** (string) - Fiscal data driver version. - **fn_num** (string) - Fiscal memory number. - **factory_num** (string) - Factory number. - **service** (object) - Service information. - **receipt_url** (string) - URL to the receipt. #### Response Example ```json { "doc": { "reg_time": "2019-01-01T12:00:00", "shift_num": 1, "index": 1, "fiscal_sign": 2, "fiscal_num": 1111111111 }, "cashbox": { "rn": "000444444444444", "ffd": "4", "fn_num": "9999999999999999", "factory_num": "555555555555" }, "service": { "receipt_url": "https://example.com/d5djQyNncxbFx1MDAxZDkxRkZEMFx1MDAxZDk" } } ``` #### Error Responses - **200**: OK - Status of the correction receipt retrieved successfully. - **202**: Accepted - Processing of the correction receipt is not yet complete; check the status again in a few seconds. - **400**: Bad Request - Syntax or structure error in the correction receipt. - **401**: Unauthorized - Invalid `actor_id` or `actor_token`, or missing/invalid authorization header. - **402**: Payment Required - Cash group or company is inactive. - **403**: Forbidden - Actor making the request is deactivated. - **404**: Not Found - Receipt with the specified `receipt_id` does not exist for this cash group, or the actor does not have access to it. - **500**: Internal Server Error - Server error, please try again. - **503**: Service Unavailable - Server error, please try again. ``` -------------------------------- ### Receipt Status Response (200 OK) Source: https://api.digitalkassa.ru/v2.1/doc/index Provides the details of a successfully retrieved receipt. This includes registration time, shift number, fiscal sign, and cashbox information. The response is in JSON format. ```json { "doc": { "reg_time": "2019-01-01T12:00:00", "shift_num": 1, "index": 1, "fiscal_sign": 2, "fiscal_num": 1111111111 }, "cashbox": { "rn": "000444444444444", "ffd": "4", "fn_num": "9999999999999999", "factory_num": "555555555555" }, "service": { "receipt_url": "https://example.com/d5djQyNncxbFx1MDAxZDkxRkZEMFx1MDAxZDk" } } ```