#econobro

1 messages · Page 1 of 1 (latest)

cloud notchBOT
dusty frost
#

Hi orakaro!

wraith helm
#

Hi!

#

We have a built in Pricing table, have you tried it?

dusty frost
#

Yes I did but it doesn't work with my app. I need to run my code but pass the price IDs to the server function and then push the user to the checkout screen

#

Are there docs that might help me do that? I haven't been able to find any on the site.

wraith helm
#

I need to run my code but pass the price IDs to the server function and then push the user to the checkout screen
This sounds simple enough to me. It's only to send price Id as a parameter in a POST request from your frontend to backend

#

then in your call to create Checkout Session in backend, simply supply that parameter

dusty frost
#

Yes but on the backend I have to pass the price id--as a variable--to the checkout session. The docs said to hide the price id variables in the .env file (and not send them through the client) so if I have three options on the front end how do I make sure the correct price ID is sent on the back end?

#

Because I have a price id variable for each of my three tiers

wraith helm
#

The Doc is just an example 🙂 You can think of sending price id over like any normal POST parameter

#

The way it's written that way is because it's generally good practice to use price id from server-side. But nothing can stop you from sending it from client-side

dusty frost
#

Ya I think that's what I"m struggling with. Thank you for your quick responses and I should share that I'm a beginner/intermediate.

#

Okay quick question...

#

if I have ids "basic" "scaled" and "enterprise" coming from the client... how do I assign the corresponding priceID variable to the server code?

wraith helm
#

um you build a map in your server-side language? Like {"basic" -> price_xxx, "scaled" -> price_yyy" ....}

dusty frost
#

and I would do that in place of '{{PRICE_ID}}' ?

wraith helm
#

no, you have the map beforehand, then from the parameter, take the corresponding price_xxx or price_yyy from the map, then pass the value to the place of {{PRICE_ID}}

dusty frost
#

Got it. I'll look into how to do that. Thank you.