Skip to main content
More in Learn

Tripletex Inventory Stock Sync

Tripletex is a Norwegian accounting system that allows accounting actions, invoicing, handling customer relationship management (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.

Example Mutation

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 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 Guide 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.

Example Video

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community