Tripletex inventory stock sync
Tripletex is a Norwegian accounting system that allows accounting actions, invoicing handling CRM logic and more. You can follow this quick guide to set up a stock sync between your Tripletex Inventory and Crystallize Catalogue in our Next.js Boilerplate.
Store Tripletex product id in Crystallize
One of the vital steps of this process is “connecting” your Crystallize products to the existing ones in Tripletex. To do that, you can either use the field “externalReference” in an update Product mutation (Crystallize Core API) or define a product shape that includes that field as part of a product type. We suggest using the externalReference field.
Create a webhook on new Order
One thing that is common practice for this event-driven approach is creating a webhook to handle the new inbound order (event). Your created webhook should target https://your-host/api/webhooks/tripletex-stock-sync, as this is where the code resides in the Next.js boilerplate. You can read more about creating a webhook in our developer guides section.
Set your Tripletex API keys
Make sure you create a pair of tokens you can use to allow access in the Tripletex API. Add these tokens in your .env file, or pass them as variables:
Clone the Github Repo
Make sure you clone the appropriate Tripletex branch from our Github repository. You can also use it as a reference to adjust your already existing project.
Adjust the code
Under pages/api/webhooks/tripletex-stoc-sync.js you can find the code that handles the stock syncing. Currently, the code is using the default inventory and a default 25% VAT type for every action. This can be adjusted and fit perfectly to your logic.