#koidestroyer
1 messages · Page 1 of 1 (latest)
👋 happy to help
is this subscription related? nvm
yes you need to create your own components to select the products/prices/quantities then you can use the deferred payment flow where you don't have to create the Payment Intent ahead of time
https://stripe.com/docs/payments/accept-a-payment-deferred
I see - and is there an option to make the payment element preload? I get a noticeable delay when loading the page up - my components appear and then the stripe element loads and appears. Can I somehow prevent this
this is the approach where the payment element loads first then after collecting the payment info you create the payment intent
Yeah, but when you mount it later it appears after. So basically I need to have 2 separate views, the first to select the amount and a second, later view for the payment element?
If you will be loading the PaymentElement at the moment of updating the quantity/final price, you can use the guide my colleauge shared with you previously
Otherwise, you can create the PaymentIntent, mount the Stripe element, and. keep updating it whenever your customer updates the quantity:
First you update the Paymentintent, then you fetch the update on your frontend:
https://stripe.com/docs/js/elements_object/fetch_updates
To see if I get it: The way to show the quantity selector and the payment element in the same view is to update the intent when the quantity changes?
Otherwise I get an empty element until I get the quantity setup (so I need to make the customer select the quantity and then push a button to confirm so I can load up the payment element
yes
or this yes
cool
and what about the clientSecret? how is it a secret?
I mean, anybody could read it via their developer console
It's a client_seceret and not your platform secret
which means, it can be shared with the client it self yes (and so they can inspect it and see it via their dev tool)
Yes