Create or link store to chain
const url = 'https://sender.sandbox-api.kivra.com/dr/v1/stores';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"external_id":"ex000001","name":"Demo store","vat":"SE012345678989","owner_id":"1593602546268ce6ece6cf49969f52f8a724e6f1f5","address":{"street1":"Gatan 1","postalcode":"13254","city":"onebuying","country":"SWE"},"icon":{"data":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=","content_type":"image/png"},"logo":{"data":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=","content_type":"image/png"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://sender.sandbox-api.kivra.com/dr/v1/stores \ --header 'Content-Type: application/json' \ --data '{ "external_id": "ex000001", "name": "Demo store", "vat": "SE012345678989", "owner_id": "1593602546268ce6ece6cf49969f52f8a724e6f1f5", "address": { "street1": "Gatan 1", "postalcode": "13254", "city": "onebuying", "country": "SWE" }, "icon": { "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=", "content_type": "image/png" }, "logo": { "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=", "content_type": "image/png" } }'Creates a store or link to an existing store using this endpoint.
Access scope
- PARTNER
- CHAIN
Using external ID
If external ID is provided in the body a new store is created using the external ID. If the external id already exists an error is returned.
Without external ID (Deprecated)
If external ID is not provided we determine if this is an existing store based on the following fields
- name
- vat
- owner_id
It is possible to create multiple stores with the same VAT, however they all need to belong to the same owner (chain).
Request Bodyrequired
Section titled “Request Bodyrequired”Takes in a store object with required information to create a new store
object
ID provided by the POS that is unique per chain
The name of the store
The VAT number of the store
ID of the owner company (chain)
The phone number of the store
The address of the store
object
Icon displayed on the receipt
object
Base64 encoded image
The image content type
Logo displayed on the receipt
object
Base64 encoded image
The image content type
Example
{ "external_id": "ex000001", "name": "Demo store", "vat": "SE012345678989", "owner_id": "1593602546268ce6ece6cf49969f52f8a724e6f1f5", "address": { "street1": "Gatan 1", "postalcode": "13254", "city": "onebuying", "country": "SWE" }, "icon": { "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=", "content_type": "image/png" }, "logo": { "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=", "content_type": "image/png" }}Responses
Section titled “Responses”Store already exists
object
Example
{ "store_id": "15594097555922f97bfeb148d6b9a6ef76f76ebdce", "vat": "SE012345678989", "created": false}Store successfully created
object
Example
{ "store_id": "15594097555922f97bfeb148d6b9a6ef76f76ebdce", "vat": "SE012345678989", "external_id": "ex000001", "created": true}Bad request
object
Examples
{ "error_code": "40000", "short_message": "bad request", "long_message": "body is missing required fields or has invalid fields"}{ "error_code": "40002", "short_message": "bad request", "long_message": "unsupported content type header"}Unauthorized
object
Examples
{ "error_code": "40100", "short_message": "unauthorized", "long_message": "permission denied"}Not found
object
Examples
{ "error_code": "40400", "short_message": "not found", "long_message": "the requested resource could not be found"}Conflict
object
Examples
{ "error_code": "40900", "short_message": "conflict", "long_message": "company with the given vat exists"}Internal server error
object
Example
{ "error_code": "50000", "short_message": "internal server error", "long_message": "unknown error ocurred"}