Skip to main content

Fiscal System v1.2

This document describes the interaction between the Cash Register Machine (CRM) and the QIWI Kazakhstan fiscal system.


Table of Contents

Change Log

Version 1.2 - 2026-01-29

  • Added unit of measure code for ESF Information System
  • Added activity domains
  • Added parent transaction transmission

List of Abbreviations

TermDescription
FDSQIWI Fiscal Data System
OFDFiscal Data Operator OFD (Kazakhtelecom, Transtelecom)
CRMCash Register Machine
ARMAutomated Workplace (web portal)

System Description

Before starting work, the CRM must be registered in the FDS.

After registration, it is necessary to generate a key pair and register the public key in the FDS by sending the SET_KKM_PUBLIC_KEY command. After successful key registration, the CRM can enter operational mode and perform fiscal operations.

The CRM should periodically (approximately every 5 minutes) request terminal information GET_KKM_INFO to update CRM information.

General Protocol Description

  • URL address: api.osfd.kz
  • Communication via HTTP protocol.
  • Request and response bodies must be in UTF-8 encoding.
  • Data exchange format is JSON. If any fields are not required, they are omitted. It is also allowed for the value of these fields to be null.

Request Format

  • All operations are performed using the POST method. The server will return error 405 Method Not Allowed for all other methods.
  • The CRM identifier QF-KKM-ID must be specified in the header.
  • All requests must be signed with the terminal's private key. The request body must be signed. The signature itself must be in hex format and passed in the QF-Request-Sign header.

Supported signature algorithms:

  • SHA256withRSA
  • SHA1withRSA

Example of a complete request with headers and signature

POST / HTTP/1.1
Host: api.osfd.kz
Content-Length: 125
QF-KKM-ID: K24829
QF-Request-Sign-Alg: SHA256withRSA
QF-Request-Sign: babbb9da99411bf2440cd852ec7b4ba65d9ecb19590a51a90f183c88793ea52edf4b374d73fe0a277bb00fb6e1e2b9f811a76aea290f9cdccfcf63fd0f00f887431086f096e99694f33d62f47e66cfe5be684e3235df3e342267d03f2a0900ffa59bcc24f1bc571181a8d57d38b0c26389a786c8a9dd34ebce0a54882121d8f28efdd062931b36545a1268088bbde3c35fa530cbfd0172c768a4709dd1022201016629ce2c405e9390d4c17ca00ff07cb12cc0b29eb6727d4500fb6e47ae9f8ab7351931d1144ca5c5e4c46ae7e82b6072baba62bfe51819340ef4da14cfd63cd728c7bc4a544c9348e720dae20875bd6ffc1e030b2230b698aa4a6c570767d2

{"api_version":"1.0","client_soft":"KKM Emulator v1.0","kkm_id":"K24829","command":{"type":"GET_KKM_INFO"}}

General Request Structure

{
"api_version": "1.0",
"kkm_id": "1234567",
"client_request_id": "fa2cf7dd-fca3-42a8-b0bc-ebba0b945888",
"client_soft": "Cashier 3000",
"command": {
"type" : "DO_COMMAND",
"arg1" : "val1",
"arg2" : "val2"
}
}

REQUEST

ParameterTypeRequiredDescription
api_versionstringYesProtocol version
kkm_idstringYesTerminal identifier
client_request_idstringNoRequest identifier
client_softstringNoClient software information
commandobjectYesCommand
  • api_version - Version consists of two parts. major.minor

    • major - Major protocol version. If this version changes, the protocol is not backward compatible.
    • minor - Minor protocol version. If this version changes, the protocol is backward compatible. In this case, fields are only added or transition to optional status. In this case, fields are only added or transition to optional status.
  • client_request_id - serves to match logs of requests and responses from the server. The client generates it independently and ensures its uniqueness.

Response Format

{
"api_version": "1.0",
"client_request_id": "fa2cf7dd-fca3-42a8-b0bc-ebba0b945888",
"error_code": 0,
"error_token": "OK",
"error_message": "Operation completed successfully",
"result": {
"some_property": "some_value"
}
}

RESPONSE

ПараметрТипОбязательныйОписание
api_versionstringYesProtocol version
client_request_idstringNoRequest identifier
error_codei32YesNumeric response code
error_tokenstringYesSymbolic error code
error_messagestringYesError code description
session_idguidYesSession identifier
resultobjectNoCommand execution result
  • client_request_id - identifier that was passed in the request.

  • error_token - error token. This is a kind of literal identifier. Serves to denote possible error codes in a more understandable form for both humans and devices. A device can recognize the response either by error code or by error token.

  • result - Command return value. If the command does not imply a result, the property is omitted.

Primitive Data Types Description

TypeDescriptionFormat
i16Signed integer-32768 : 32767
i32Signed integer–2147483648 : 2147483647
i64Signed integer-9223372036854775808 : 9223372036854775807
moneyFixed precision number 19 with scale 2-92233720368547758.08 : 92233720368547758.07
num_10_3Fixed precision number 10 with scale 3–2147483.648 : 2147483.647
stringString
boolBooleantrue, false
datetimeDate and time"YYYY-MM-DDThh:mm:ss"
guidUniversally unique identifier"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
intervalTime interval"hh:mm"
hexByte array"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  • datetime - Date and time must be in the format YYYY-MM-DDThh:mm:ss. This format is compatible with ISO 8601. For example, date 24.06.2018 18:30:02 Astana time should be 2018-06-24T18:30:02.

  • hex - Byte array must be transmitted in hexadecimal format, lowercase without byte separators.
    Example: "bd637b59816232bf99f183fb7b8a6a06"

  • money - Value can be transmitted as text.
    Example: "12.05"

  • num_10_3 - Value can be transmitted as text.
    Example: "12.345"

Common Data Types Description

Cashier Operator Information CASHIER_INFO

ParameterTypeRequiredDescription
codeintYesCashier operator code
namestringYesCashier operator name

Command Description

Terminal Public Key Registration SET_KKM_PUBLIC_KEY

Request Arguments Format

{
"type": "SET_KKM_PUBLIC_KEY",
"kkm_pub_key": {
"type": "RSA_PUBLIC_KEY",
"modulus": "00aa18aba43b50deef38598faf87d2ab634e4571c130a9bca7b878267414faab8b471bd8965f5c9fc",
"public_exponent": "010001"
}
}

ParameterTypeRequiredDescription
kkm_pub_keyobjectYesKKM public key
  • List of supported kkm_pub_key:
    • RSA_PUBLIC_KEY

RSA Public Key RSA_PUBLIC_KEY

ParameterTypeRequiredDescription
modulushexYesModulus
public_exponenthexYesPublic exponent

Response Result Format

The command does not imply a result.

Get Terminal Information GET_KKM_INFO

Request Arguments Format

{
"type": "GET_KKM_INFO"
}

Response Result Format

{
"kkm": {
"kkm_id": "123456",
"kkm_serial_number": "345234",
"kkm_kgd_id": "123456789012",
"timezone": "06:00",
"is_ready": true,
},
"organization": {
"title": "ТОО Касса 24/7",
"address": "Жубанова 42",
"iinbin": "123456789012",
},
"position": {
"title": "Торговая точка 1",
"address": "Муканова 23",
},
"taxation": {
"taxation_type": "USN",
"taxes":[
{
"tax_type": "NDS",
"tax_rate_percent": "18.000"
}

]
},
"cash_amount": "1240.00",
"last_shift": {
"shift_number": 123,
"open_date": "2019-03-13T23:44:00",
"is_closed": true,
"expiry_date": "2019-03-14T23:44:00",
"close_date": "2019-03-13T22:44:00"
}
}

ParameterTypeRequiredDescription
kkmKKM_INFOYesKKM information
organisationORGANISATION_INFOYesOrganization information
positionPOSITION_INFOYesSales position information
cash_amountmoneyYesAmount of cash in the cash register
taxationTAXATION_INFONoInformation about linked taxation
last_shiftLAST_SHIFT_INFONoInformation about the last shift

Last Shift Information LAST_SHIFT_INFO

ParameterTypeRequiredDescription
shift_numberi32YesShift number
open_datedatetimeYesShift opening date
is_closedboolYesWhether the shift is closed
expiry_datedatetimeYesShift expiry date, if the shift is closed
close_datedatetimeNoShift closing date, if the shift is closed

Информация о ккм KKM_INFO

ParameterTypeRequiredDescription
kkm_idstringYesККМ identifier in SFD
kkm_serial_numberi32YesККМ factory number
kkm_kgd_idstringYesККМ KGD code
timezoneintervalYesTimezone to which the KKM is bound
is_readyboolYesWhether the terminal is ready for work
  • is_ready - If status is false then the CRM must suspend its operation. This can be in the following cases:

    • ККМ is in the registration stage
    • ККМ is in the deregistration stage
    • ККМ is in programming mode
    • Payment prohibition from the OFD side
    • Fiscal operations being performed from the ARM side

Organization Information ORGANIZATION_INFO

ParameterTypeRequiredDescription
iinbinstringYesIIN/BIN
titlestringNoOrganization name
addressstringNoOrganization address

Sales Point Information POSITION_INFO

ParameterTypeRequiredDescription
titlestringNoSales point name
addressstringNoSales point address

Taxation Information TAXATION_INFO

ParameterTypeRequiredDescription
taxation_typeTAXATION_TYPE_ENUMYesTaxation type
taxesTAX_INFO[]NoTax information

Tax Information TAX_INFO

ParameterTypeRequiredDescription
tax_typeTAX_TYPE_ENUMYesTax type
tax_rate_percentnum_10_3YesTax percentage

Register Ticket Transaction REGISTER_TICKET

Request Arguments Format

{
"type": "REGISTER_TICKET",
"client_txn_id": "d108a81b-1a0e-4b7b-824e-a25bd64b21a4",
"client_txn_date": "2018-05-03T16:27:30",
"is_offline": false,
"operation_type" : "SELL",
"total": "180.00",
"items": [
{
"type": "COMMODITY",
"section_code": "Секция 1",
"name": "Пицца с грибами",
"quantity": "2.000",
"price": "200.00",
"total": "400.00",
"measure_unit_code": "642"
},
{
"type": "STORNO_COMMODITY",
"section_code": "Секция 1",
"name": "Пицца с грибами - отмена",
"quantity": "2.000",
"price": "200.00",
"total": "400.00",
"measure_unit_code": "642"
},
{
"type": "COMMODITY",
"section_code": "Секция 1",
"name": "Пицца с сыром",
"quantity": "1.000",
"price": "200.00",
"total": "200.00",
"measure_unit_code": "642"
},
{
"type": "MARKUP",
"name": "Наценка",
"total": "20.00"
},
],

"total_modifier": {
"type": "DISCOUNT",
"name": "Общая скидка",
"total": "40.00"
},

"taxes" : [
{
"tax_type": "NDS",
"taxation_type": "USN",
"tax_rate_percent": "18.000",
"total": "27.46",
"is_included_in_total": true
},
{
"tax_type": "NDS",
"taxation_type": "USN",
"tax_rate_percent": "10.000",
"total": "13.86",
"is_included_in_total": true
},
],

"payments": {
"cash": {
"amount": "180.00",
"taken": "1000.00",
"change": "820.00"
}
},
"cashier": {
"code": 12,
"name": "Иванов"
},
"customer": {
"iinbin": "123456789012"
}
}

ParameterTypeRequiredDescription
client_txn_idguidYesTransaction identifier assigned by the client
client_parent_txn_idguidYes (при отмене)Parent transaction identifier. Only for SELL_RETURN or BUY_RETURN
client_txn_datedatetimeYesTransaction date at the time of operation
is_offlineboolYesOffline or online mode (whether receipt was printed or not)
operation_typeTICKET_OPERATION_TYPE_ENUMYesOperation type
totalmoneyYesTotal amount of ticket transaction
itemsobject[]YesList of goods/services
total_modifierobjectNoGeneral discount or markup
taxesTAX[]NoTax on receipt (absent if taxes are specified in elements)
paymentPAYMENT_INFOДаPayment information
cashierCASHIER_INFONoCashier operator information
customerCUSTOMER_INFONoCustomer information
domainDOMAIN_INFONoActivity domain information
  • List of supported items types:

    • COMMODITY
    • STORNO_COMMODITY
    • DISCOUNT
    • STORNO_DISCOUNT
    • MARKUP
    • STORNO_MARKUP
  • List of supported total_modifier types:

    • DISCOUNT
    • MARKUP
  • taxes - tax with a specific percentage should appear no more than once.

Also, if the taxes field is specified in the receipt, then it should be absent in individual items/taxes elements.

  • List of supported domain types:
    • TRADING_DOMAIN
    • SERVICES_DOMAIN
    • TAXI_DOMAIN
    • PARKING_DOMAIN
    • HOTELS_DOMAIN
    • GASOIL_DOMAIN

Product/Service Information COMMODITY

ParameterTypeRequiredDescription
section_codestringYesSection or department code
namestringYesName
quantitynum_10_3YesQuantity
pricemoneyYesPrice
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)
excise_stampstringNoExcise stamp number
measure_unit_codestringNoUnit of measure code for ESF Information System

Product/Service Storno Information STORNO_COMMODITY

ParameterTypeRequiredDescription
section_codestringYesSection or department code
namestringYesName
quantitynum_10_3YesQuantity
pricemoneyYesPrice
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)
excise_stampstringNoExcise stamp number
measure_unit_codestringNoUnit of measure code for ESF Information System

Discount Information DISCOUNT

ParameterTypeRequiredDescription
namestringYesName
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)

Discount Storno Information STORNO_DISCOUNT

ParameterTypeRequiredDescription
namestringYesName
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)

Markup Information MARKUP

ParameterTypeRequiredDescription
namestringYesName
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)

Markup Storno Information STORNO_MARKUP

ParameterTypeRequiredDescription
namestringYesName
totalmoneyYesTotal amount
taxesTAX[]NoList of taxes (absent if present in receipt)

Tax Information TAX

ParameterTypeRequiredDescription
tax_typeTAX_TYPE_ENUMYesTax type
taxation_typeTAXATION_TYPE_ENUMYesTaxation type
tax_rate_percentnum_10_3YesTax value in percentage
totalmoneyYesTax value in money
is_included_in_totalboolYesWhether tax is included in the amount

Payment Information PAYMENT

ParameterTypeRequiredDescription
cashCASH_PAYMENTNoCash payment information
cardCARD_PAYMENTNoCard payment information
creditCREDIT_PAYMENTNoCredit payment information
tareTARE_PAYMENTNoTare payment information

Cash Payment Information CASH_PAYMENT

ParameterTypeRequiredDescription
amountmoneyYesAmount for cash payment
takenmoneyYesTaken in cash
changemoneyYesChange

Card Payment Information CARD_PAYMENT

ParameterTypeRequiredDescription
amountmoneyYesAmount for card payment

Credit Payment Information CREDIT_PAYMENT

ParameterTypeRequiredDescription
amountmoneyYesAmount for credit payment

Tare Payment Information TARE_PAYMENT

ParameterTypeRequiredDescription
amountmoneyYesAmount for tare payment

Customer Information CUSTOMER_INFO

ParameterTypeRequiredDescription
iinbinstringNoCustomer IIN/BIN
phonestringNoCustomer phone
emailstringNoCustomer email
Operation Types (TICKET_OPERATION_TYPE_ENUM)
ЗначениеDescription
BUYPurchase
BUY_RETURNPurchase return
SELLSale
SELL_RETURNSale return
Taxation Types (TAXATION_TYPE_ENUM)
ЗначениеDescription
USNУСН
OSNОСН
PEASANT_AND_FARMTax regime for peasant and farm households
SMALL_BUSINESS_PATENTTax regime for small enterprises based on patent
Tax Types (TAX_TYPE_ENUM)
ЗначениеDescription
NDSНДС

Trading Domain TRADING_DOMAIN

Не содержит полей.

Services Domain SERVICES_DOMAIN

ParameterTypeRequiredDescription
account_numberstringYes

Gas/Oil Supply Domain GASOIL_DOMAIN

ParameterTypeRequiredDescription
card_numberstringNo
correction_numberstringNo
correction_summoneyNo

Hotels and Restaurants Domain HOTELS_DOMAIN

Contains no fields.

Taxi Domain TAXI_DOMAIN

ParameterTypeRequiredDescription
car_numberstringYes
is_orderboolYes
current_feemoneyYes

Parking Domain PARKING_DOMAIN

ParameterTypeRequiredDescription
begin_timedatetimeYes
end_timedatetimeYes

Response Arguments Format

{
"is_offline": false,
"ofd_ticket_number": "AS2304342",
"ofd_ticket_qr_code": "687474703a2f2f636f6e73756d65722e746573742d6f6f66642e6b7a3f693d3131393635373238373126663d36373839383031323334353626733d302e3026743d323032303035313854313831383137",
"offline_ticket_number": 123453,
"shift_number": 22,
"shift_document_number": 11
}

ParameterTypeRequiredDescription
ofd_ticket_numberstringNoReceipt number received from OFD
ofd_ticket_qr_codehexNoQR code received from OFD
offline_ticket_numberi32YesAutonomous receipt number
is_offlineboolYesWhether receipt was online or offline
shift_numberi32YesShift number
shift_document_numberi32YesDocument number in shift

If the payment was offline, then is_offline: true, but ofd_ticket_number and ofd_ticket_qr_code will be absent.

Cash Withdrawal WITHDRAW_MONEY

Request Arguments Format

{
"type": "WITHDRAW_MONEY",
"client_txn_id": "5d8b06e4-0560-4dcd-8162-8bb23f5ee258",
"client_txn_date": "2018-05-03T16:27:30",
"amount": "2345.00"
}
ParameterTypeRequiredDescription
client_txn_idguidYesClient transaction identifier
client_txn_datetimestampYesTransaction date
amountmoneyYesAmount of money

Response Arguments Format

{
"shift_number": 22,
"shift_document_number": 11
}

ParameterTypeRequiredDescription
shift_numberi32YesShift number
shift_document_numberi32YesDocument number in shift

Cash Deposit DEPOSIT_MONEY

Request Arguments Format

{
"type": "DEPOSIT_MONEY",
"client_txn_id": "603dc6a3-ab05-49d0-9059-ed3599b2fae7",
"client_txn_date": "2018-05-03T16:27:30",
"amount": "2345.00"
}
ParameterTypeRequiredDescription
client_txn_idguidYesClient transaction identifier
client_txn_datetimestampYesTransaction date
amountmoneyYesAmount of money

Response Arguments Format

{
"shift_number": 22,
"shift_document_number": 11
}

ParameterTypeRequiredDescription
shift_numberi32YesShift number
shift_document_numberi32YesDocument number in shift

Shift Close CLOSE_SHIFT

Request Arguments Format

{
"type": "CLOSE_SHIFT",
"shift_number": 5,
"cashier": {
"code": 12,
"name": "Иванов"
}
}
ParameterTypeRequiredDescription
shift_numberi32YesShift number
cashierCASHIER_INFONoCashier operator information

shift_number - should be the last open shift

The command does not imply a result.

Error Codes

Successful Operation 0

CodeTokenDescription
0OKOperation completed successfully.

Request Format Errors 1xx

CodeTokenDescription
100FMT_ERRInvalid request format.

Domain Errors 2xx

CodeTokenDescription
200DMN_ERRCurrently impossible to perform this operation in the current terminal state or with current parameters.
201DMN_ERR_AUTH_FAILEDInvalid terminal identifier or signature.
202DMN_ERR_KKM_NOT_FOUNDККМ not found.
203DMN_ERR_NOT_ENOUGH_CASHInsufficient cash to perform the operation.
204DMN_ERR_KKM_BLOCKEDTerminal is blocked. Any operations are prohibited.
205DMN_ERR_KKM_BLOCKED_BY_OFDTerminal is blocked on the OFD side. Fiscal operations are prohibited.
206DMN_ERR_KKM_BLOCKED_BY_OFD_ERRORTerminal is blocked because there is an error in data transmission to OFD. Manual intervention is required.
207DMN_ERR_SHIFT_NOT_FOUNDShift not found.
208DMN_ERR_INVALID_TICKETReceipt is incorrectly formed.

Server Errors 3xx

CodeTokenDescription
300SRV_ERRServer-side error. In this case, the request should be sent later.