POS sync inventory

Synchronize POS item information with your inventory system

Sync inventory

POST https://integrations.mipos.shop/api/v1/inventory/pos/store/{store_id}/system/sync

Send inventory content from the POS to the inventory system.

Path Parameters

Headers

Request Body

{
    "message": "Synchronization data was sent to the inventory system.",
    "data": null
}

Body example

{
	"items": [
		{
			"name": "Testing item 1",
			"external_id": "item_abc123",
			"purchase_unit_external_id": "pos_u1",
			"consumption_unit_external_id": "pos_u2",
			"supplier_external_id": "pos_sup_1",
			"cost": "1250",
			"stock": "11.22"
		},
		{
			"name": "Testing item 2",
			"external_id": "item_abc456",
			"purchase_unit_external_id": "pos_u2",
			"consumption_unit_external_id": "pos_u2",
			"supplier_external_id": "pos_sup_1",
			"cost": "100",
			"stock": "5.50"
		}
	],
	"user_id_tps": "30",
	"inventory_system_id": "3d40a24e-d570-4598-ae68-e20687edd1f9",
	"units": [
		{
			"name": "Unit 1",
			"short_name": "u1",
			"external_id": "pos_u1"
		},
		{
			"name": "Unit 2",
			"short_name": "u2",
			"external_id": "pos_u2"
		}
	],
	"suppliers": [
		{
			"name": "supplier 1",
			"external_id": "pos_sup_1"
		}	
	]
}

Send update of stock of an item

POST https://integrations.mipos.shop/api/v1/inventory/pos/store/{store_id}/system/stock/update

Path Parameters

Headers

Request Body

Any other error response you receive from this endpoint comes directly from the inventory system.

Body example

{
	"user_id_tps": "30",
	"inventory_system_id": "4344be8c-c6b9-4c51-88a6-d620144ab406",
	"current_stock": "12.44",
	"quantity": "1.25",
	"date": "2020-05-30 12:45:03",
	"movement_type": 2
}

Webhooks

The inventory system can send different types of data about its items, the POS system that you have registered can receive this data by registering the urls of the webhooks where it wants to receive each of these types. Types of information that the POS sends:

  • Type 3: Receive the stock update of an inventory item

Manage Webhook

POST https://integrations.mipos.shop/api/v1/inventory/pos/webhook/manage

Create or update inventory system webhooks.

Headers

Request Body

{
    "message": "Webhook successfully created.",
    "data": null
}

These webhook requests will send a header called X-Signature-Request, as a security measure to confirm that the request came from our system.

Webhook(Type 3 - Receive stock update item)

The value of this field is a hexadecimal HMAC signature of the body request payload, using the client secret as a key(generated on account creation) and SHA256 as the hash function.

Example

Using the body example

client_secret:

9468da7ccaed13055abcf183fb05c73e8cfc48c5

Signature: 7c38c67ad234c4cdbe71425b5c961805ac3955d87de40d1d63e09f1f76d1ff61

Content Body

JSON received example

{
    "pos_id": "1",
    "inventory_system_id": "4344be8c-c6b9-4c51-88a6-d620144ab406",
    "current_stock": "12.44",
    "quantity": "1.25",
    "date": "2020-05-30 12:45:03",
    "movement_type": 2,
    "external_id": "avcc123",
    "now": "2020-06-01 02:55:18",
    "store_id": 1
}

Expected response

Your service should POST a 204 response status code with an empty response body to acknowledge receipt of the webhook event. If an error occurs in your POS system, the response must be returned with the respective status code and the body must include a field called message, this will be taken to show it to the Inventory System.

Last updated