How to add custom products to a cart?

Trying to add some functionality to a Shopify store and hoping to get some help/overview of whether what I want to achieve is doable, and if so, which API’s or tools I’ll need to get it done.

Basically I will have a page where a ‘product builder’ tool will be embedded, user can choose from multiple options to build out a custom product, upload an image, etc, and the tool will price it out. The user’s choices will be stored in a separate backend.

In the backend the data is going to get validated, and I want the backend to add this custom unique product to the cart. So ideally when the custom product is added, I’m just sending a cart ID and a reference ID for the product customizations to the backend.

  • Is this the correct way this should be handled?
  • Do I have access to the cart ID in the frontend to send it along on submit?
  • Can an arbitrary product that is not defined in Shopify be added to a cart?
    – (Custom product would consist of several key/value pairs for the customizations, price, image)

I noticed I can get access to a cart token at /cart.json but it is unique on each load, is this used to then retrieve a cart ID, or can I access the cart ID directly?

Just getting started with this and any help or guidance on where to start looking would be much appreciated.