VCR API V1.0
SDK for integrating with VCR on Node.js: @blob-solutions/vcr-am-sdk
Overview
Allows you to integrate any of your systems to work with VCR.
Requirements for your system
Before starting integration, make sure that your system meets the following requirements. And if it does not match, then make the necessary changes.
- Each offer (service or product) must contain:
- A code from the commodity classifier for goods or a code from the classifier of economic activities for services;
- Unit of measurement (for example, "kg", "pcs", "m2" for goods or "hour", "service", "work" for services);
- Department ID
- Cashier ID
Authorization
All API requests must include the X-API-KEY
header, containing your API key. Do not disclose your API key in public places.
You can get it in the cash register settings.
X-API-KEY: your_API_key
Errors
400 Bad Request
- Invalid request.401 Unauthorized
- Invalid or missing API key.403 Forbidden
- Access denied.404 Not Found
- The requested resource was not found.500 Internal Server Error
- Internal server error.
Endpoints
Sale Registration
- URL:
/api/v1/sales
- Method:
POST
- Authorization: Required
- Request example:
POST /api/v1/sales
Headers:
X-API-KEY: your_API_key
Content-Type: application/json
Body:
{
"cashier": {
"id": 1
},
"amount": {
"nonCash": "1.23",
"cash": "4.56",
"prepayment": "7.89",
"compensation": "0.12"
},
"buyer": {
"type": "individual",
"receipt": {
"email": "[email protected]",
"language": "hy"
}
},
"items": [
{
"offer": {
"title": {
"type": "localized",
// If "localized", then only Armenian language is required and the rest are optional.
// If rest are not provided (as in our case), it will be translated (or transliterated) from Armenian to the required language.
"content": {
"hy": "Վարունգներ" // Up to 50 characters
// "en": "Cucumbers"
// "ru": "Огурцы"
},
"localizationStrategy": "translation" // or "transliteration"
},
"type": "product", // or "service"
"classifierCode": "0710",
"defaultMeasureUnit": "kg",
"defaultDepartmentId": 1,
"externalId": "pum-pam-123"
},
"departmentId": 1,
"quantity": 1.234,
"price": 5.67,
"unit": "kg",
"discounts": {
"base": {
"type": "percent",
"value": 12.34
}
},
"totalAmountTolerance": "0.01"
},
{
"offer": {
"title": {
"type": "universal", // Will be used for all languages
"content": "Apple MacBook Pro 14-inch 2021" // Up to 50 characters
},
"type": "product",
"classifierCode": "0710",
"defaultMeasureUnit": "kg",
"defaultDepartmentId": 2,
"externalId": "woop-woop2"
},
"departmentId": 2,
"quantity": 2.345,
"price": 6.78,
"unit": "other",
"discounts": {
"base": {
"type": "percent",
"value": 23.45
},
"additional": {
"type": "total",
"value": 5678.9
}
}
},
{
"offer": {
"title": {
"type": "localized",
"content": {
"hy": "Վարունգ3"
},
"localizationStrategy": "translation"
},
"type": "product",
"classifierCode": "0710",
"defaultMeasureUnit": "kg",
"defaultDepartmentId": 3,
"externalId": "fwefw435gt3q"
},
"departmentId": 3,
"quantity": 3.456,
"price": 7.89
}
{
"offer": {
"externalId": "woop-woop2"
},
"departmentId": 2,
"quantity": 2.345,
"price": 6.78,
"unit": "other",
"discounts": {
"base": {
"type": "percent",
"value": 23.45
},
"additional": {
"type": "total",
"value": 5678.9
}
}
},
{
"offer": {
"externalId": "fwefw435gt3q"
},
"departmentId": 3,
"quantity": 3.456,
"price": 7.89
}
]
}
- Response example:
{
"saleId": 545,
"crn": "12345678",
"srcReceiptId": 123,
"fiscal": "83615312"
}