Answered

How to insert dynamic variables/text from an external AP ?

  • 4 April 2022
  • 5 replies
  • 1178 views

Hi Everyone , I’m building a form with typeform which has dynamic displayed text depending on a hidden field product_id , this is the flow:
1 - User clicks on an url typeform…./?product_id=id
2 - Typeform should retrieve data from an external API to diplay the text in typeform depending on the returned data.
3 - Each product has a price (returned in step2) , that price will be used for a checkout with stripe.

I can use the other fields as hidden fields but not the price because anyone can change it in the url and pay whatever he wants to pay.

How can I achieve this ?
Thank you

icon

Best answer by Liz 4 April 2022, 21:17

View original

5 replies

Userlevel 7
Badge +5

Hi @Skander Welcome to the community! Happy to have you here. Sounds like quite the form you’re building! What products are you selling in the form? 

It isn’t possible to connect to an external API, so you would need to have all the pricing/products set in the form. Though, you could use logic jumps to show the specific pricing/product as it applies. 

Thank you @Liz for this quick answer. 

I’m selling digital products (trainings). Each user will register for a paid training. I can’t create a form for each training because there are a lot and they are created on another platform.

I’m thinking of :
- Get the data from the API and creating a form on the fly for each user.
- Setup a Webhook to register the data to the same API after a user has submitted an answer and because I don’t want to have thousands of forms so I have to delete it after each answer.

So I have two questions :
- Is that a good solution ?
- Can I create a form on the fly and setup a stripe payment with and custom design via the API ?

 

Userlevel 7
Badge +5

Hi @Skander Ah, thank you! Talk about a fancy solution! @mathio or @picsoung might have better opinions on this since they know more about the API and its capabilities than I do. 

As for the API itself, you can find the documentation here, which will outline what you can/can’t do with the API. 

Userlevel 7
Badge +5

Hi @Skander 
I guess it really depends on the number of products you are selling and how complex you want your form to be.

If you are looking for a “one size fits all” type of scenario, you may be able to achieve this using a combination of hidden fields, variables, and logic.

But your solution to create forms on the fly, could work too :)

Thank you @Liz and @picsoung 

Reply