#maire_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1283857113600364545
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- maire_code, 21 hours ago, 23 messages
- maire_attach-klarna, 23 hours ago, 30 messages
- maire_code, 1 day ago, 8 messages
Hello! Usually when you call confirmSetupIntent you pass the Setup Intent's clientSecret, which ties that call to that specific Setup Intent: https://docs.stripe.com/js/setup_intents/confirm_setup#confirm_setup_intent-options-clientSecret
As far as the Customer assocation piece, can you share the code you're using to associate the Setup Intent to the Customer?
where does client secret go? I am on an older version of stripe-js
this is how we are confirming setup intent
It looks like you're using an older version of the stripe-node library on your server, but confirmSetupIntent is part of Stripe.js and is called client-side, in the browser. Stripe.js is always the newest version, you can't use older versions of it.
You would pass the client secret from your server to your client-side code in order to include it there when you call confirmSetupIntent.
right but I don't see it as an param option under stripe.confirmSetup
I linked to the documentation where it shows it as a parameter. Can you provide more details about what you mean by not seeing it?
Hi there ๐ jumping in as my teammate needs to step away soon. Are you using our stripe-js wrapper to get type support? The one we have here:
https://github.com/stripe/stripe-js
Ah gotcha. That doesn't actually change the version of stripe.js that is pulled in, as Rubeus mentioned the newest version of that is always used, but it could mean the types you're seeing are outdated/incomplete for the current state of stripe.js.
Can you share what version of stripe-js you're currently using?
Okay lots to update on my end but now confirmSetupIntent does not return setupIntent. Do you suggest fetching payment methods manually vs. from the setupIntent.payment_method which is what we used to do
To clarify, are you using confirmSetupIntent or confirmSetup (as shown in the screenshots provided earlier)?
we are using confirmSetup sorry our internal method is confirmSetupIntent
I think I can actually get the payment methods from .retrieveSetupIntent
How/where do you need details from the Payment Method that is created? Is that something you need to consume server-side?
yes if for instance they choose to toggle to a different payment method (saved payment method)
more so for stored cards
Not sure I'm following, toggling to a different saved payment method would be part of your payment flow right, rather than this setup intent flow?
But if you need it server-side I would recommend either retrieving the intent or using a webhook endpoint to be notified when the Setup Intent completes.
Ideally yes they should be separate.
so since a return_url is passed to confirmSetup, any code after that function is called will not be called correct? since it redirects
Correct
We are trying to avoid creating a stripe customer until they are at the final checkout step where we call confirmSetup , but maybe our flow is not ideal.
Here is what we have now:
generateSetupIntent when the checkout process starts
after they put in their shipping address we create the stripe customer and updateSetupIntent with stripe customer id
after they choose card vs. klarna we call elements.submit() and confirmSetup
That sounds reasonable, is that giving you problems?
We just have code that used to run after confirmSetup and we would just confirm the setupIntent came back successfully vs. erroring
if confirmSetup returns an error - it shouldn't still redirect to the return url right?
its lines 133 - 156 that need to be handled now
Correct, confirmSetup returns a promise that either resolves with an error in case of a failure, or a redirect occurs before the promise resolves in the case of a success.
okay great. You have been so helpful! I'll continue to work on things on my end