Dynamic configurated Products - Prices and Validation

Shopify Partner
4 0 1

I code an product configurator (javascript) app for the app store and calculate prices and options dynamically.

How can I add that product to the cart/checkout in a validated secure way?


My idea is 

1. validate configuration on my server

2. add product variant with price via API

3. add that variant to the cart via API


is this the way to go or are there other options?