#DeMe

1 messages · Page 1 of 1 (latest)

sour palmBOT
wheat flame
#

Hi there

#

Overall there are a bunch of different ways to handle this. You can either use your own ID alongside the Stripe Price ID and store that in your database or you can use the Price ID directly. When the customer selects an option on your client you want to send the necessary data to your backend to be able to map to the correct Price ID

digital stream
#

When I run a query to get the stripe prices this is my return

#

Do I use one of these properties to display the price?

marble turtle
#

Hi 👋 jumping in as my teammate needed to step away. That is up to you. If you want to use the Price object you created with us as your source of truth, then you can reference the amount that you specified (keeping in mind that is represented in the smallest unit for the chosen currency, so cents for usd as an example).

digital stream
#

Thanks, now when I console.log

console.log("stripe price", prices?.data[0]?.unit_amount_decimal);

I get back 3000

#

When it should be 30.00 do I have to manually convert it to a decimal value myself?

marble turtle
#

Yes

digital stream
#

Does the Stripe api have a number to currency converter?

marble turtle
#

No

#

Is there a reason you're planning to rely on Stripe to track your prices? It seems like needing to query our API would slow down your process when you likely already know what your prices are expected to be.

sour palmBOT
digital stream
#

So at the moment I just call all the products using the api and display them, and I wanted to show the prices in the store.

I guess I could make constants that show that price if the product id is == to that product's id?

#

At the moment I am not creating a storeProduct model, so I don't have prices attached to the products

marble turtle
#

Gotcha, it's probably fine to reference the prices stored in Stripe, it just sounds like it may slow down your page load/rendering. I guess how you structure it is also going to be dependent on how large your catalog of products/prices is going to be, as you'll need to think about how you're going to maintain those prices as well.

#

Sorry, think I'm getting into the weeds here.

digital stream
#

Hmm what would you suggest to be more optimal? I have less than 10 products right now but it could scale up to 100-200 over time.

marble turtle
#

You'll only be able to list 100 per request, that's our limit for list requests, so if you go over that you'll need to start making multiple requests with pagination.

How often are your prices changing? If they're staying pretty constant then I'd be inclined to embed them in your sites code rather than having them be a lookup, but I'm not certain that would be the best approach.

digital stream
#

Ah I see

They won't be changing a lot maybe an occasional special or sale

I think I'll embed them in the code for now, if some problem arises I'll look into something else

#

Thanks for the help