#redapse
1 messages · Page 1 of 1 (latest)
Hello 👋
Can you walk me through your logic of rendering elements? What happens first? Do you make a fetch the SetupIntent and then initialise elements? What error are you getting?
Hello hanzo, thanks for the reply
sure, so stripe gets initialized via the publishable key, then from the browser I request from our API to build a new SetupIntent. That SetupIntent is returned to the browser. I use that SetupIntent to build options that I feed into stripe.elements()
After that I create the 'payment' element and mount it
I see.
What error are you getting?
huh are you sure that's coming from Stripe.js?
Is this page public? If so, would you be able to share the URL?
yes, it's coming from the controller js script that stripe loads
here's a codepen, but you need to insert a brand new SetupIntent
if I wait say 5 seconds, it works, but... thats no fun
yep exactly. I just wonder if the SetupIntent needs to be like X number of seconds old before it will process correctly on Stripe's side
is this plausible
I wonder if the setupintent storage is decoupled from the API the stripe.js elements use
I've not heard of any similar cases before. It is possible that your API might be a little slow to respond with SetupIntent clientSecret.
nah it's waiting to initialize the rest of the stripe JS code AFTER the browser receives from my API the SetupIntent
so my API can take as long as it wants to, because only after the browser gets it does it start the elements process
But if I throw a delay between when I generate the SetupIntent say of 5 seconds, and then I try to create the element, it works
When you rest of the Stripe JS code, does it also include following?
stripe = window.Stripe("pk_test_xxx")
Are you intializing Stripe with public key, before or after retrieving the SetupIntent?
We usually recommend you initialise it as soon as the page loads.
it's being initialized before the setupintent is being retrieved from your API
also does the behavior change if you move following tag before <form> tag?
<script src="https://js.stripe.com/v3/">
I noticed you're not using defer keyword
no change moving the script or adding defer
I wonder if there are background processes happening at Stripe and SetupIntents just need to be a few seconds old before doing anything with them
if that's the case I can work around it, I just would rather like to know and build in better safeguards against a SetupIntent being too young
or does stripe.js (and initialized) need to be loaded on the page for like 5 seconds or something
I don't think its that.
Have you tried using a different browser?
OK I did try it in Firefox without the delay, and surprisingly I cannot reproduce the error
Any way to file a chrome bug with the stripe team or something
FYI the file throwing the error is https://js.stripe.com/v3/fingerprinted/js/controller-6f74256f6411380feccc22f87365e78c.js
idk if it's possible to disable fingerprinting or something until this is fixed
Hmm what chrome version are you running?
Version 109.0.5414.61 (Official Build) beta (64-bit)
Might be something with the beta version?
Would you mind trying on the stable version/official build?
looks like it's due to the version I'm on, yep
Still probably want to track this though, you don't want the new version of Chrome to break ya stuff
Sure thing!
if you could pass on any sort of issue tracker # or what not I would appreciate it. thanks for your help
We don't have an issue tracker as such. You can write in to our support team and they should be able to create a ticket for this in case you want to follow up
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.