#leu_best-practices

1 messages ¡ Page 1 of 1 (latest)

dapper novaBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1253351270459379763

📝 Have more to share? Add details, code, screenshots, videos, etc. below.

halcyon raft
#

Hello

#

That way you only actually create the Subscription or Invoice when the customer actually hits your "pay" button.

dapper novaBOT
old storm
#

Oh that sounds great, taking a look at the docs now - thanks!

#

@halcyon raft I see the documentation mentions the Payment Element options requires an amount :

The amount passed to the Payment Element should reflect what a customer will be charged immediately. This could either be the first installment of the subscription or 0 if the subscription has a trial period.

Is there a way around this? My intention is to manage all prices on Stripe and not have to keep them synchronized to my App database.

halcyon raft
#

That amount just dictates what payment method types are shown (and what the wallet modals like Apple Pay will show for amount) since some have limitations. However it doesn't actually have any affect on the amount charged -- that is determined based on the Price that you pass in the backend.

old storm
#

Ok. I guess it would still require me to have some knowledge of what price that would be if I don't want to confuse my customers. Maybe I can use something like "upcoming invoice" API to check what that amoun is on the fly

halcyon raft
#

Not sure I understand -- your customers are selecting things into their cart on the frontend, right?

old storm
#

Correct

halcyon raft
#

So you just calculate this amount on your frontend or you do retrieve the corresponding amount from your backend based on the selections just like you would at time of payment

old storm
#

Yes, but that would require me to store the prices in my database, I would like to manage all prices in Stripe and just keep track of the product/price stripe ID's in my DB. Then I'm just creating invoices based on price ID's not amounts.

#

If it comes to it I can go that route, I was just checking if I could avoid storing price amounts in my system to remov ethe complexity around keeping them in sync with the actual prices in Stripe

#

But if there's no other way, I can always set up Webhooks to update my DB to match stripe prices or something

hexed linden
#

Hi taking over here

#

You can either store amount in your db or make an api call to get the amount. Up to you