#delgesu1745_api
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/1357041739462086790
đ 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.
- delgesu1745_api, 13 hours ago, 20 messages
- delgesu1745_api, 22 hours ago, 48 messages
- delgesu1745_api, 1 day ago, 16 messages
- delgesu1745_api, 1 day ago, 26 messages
This bit is in index.js in the doc at the beginning, but then the file referenced switches to checkout.js:
const elementsOptions = {
mode: 'setup',
currency: 'usd',
customerSessionClientSecret,
// Fully customizable with appearance API.
appearance: {/.../},
};
Also having trouble understand how this then translates to the payment form:
// Set up Stripe.js and Elements to use in checkout form, passing the client secret
// and CustomerSession's client secret obtained in a previous step
const elements = stripe.elements(elementsOptions);
// Create and mount the Payment Element
const paymentElementOptions = { layout: 'accordion'};
const paymentElement = elements.create('payment', paymentElementOptions);
paymentElement.mount('#payment-element');
Hi, I'm unsure what you mean by index.js and then referenced to checkout.js means. From looking at the guide: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup all of the client-side code is in checkout.js
Ahhh ok, I think that's the issue then. Right at the beginning of the doc it has code in index.js
But in this section: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup#save-payment-methods it switches to checkout.js?
Where do you see the index.js?
It's the component config on the client side.
So is that all in the same file as this: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup#save-payment-methods
Ah I see
I think what I don't understand is the connection between index.js (on the React side) or checkout.html (on the HTML+JS side) and checkout.js.
So Reach uses different components. This flow enables you to collect the payment method details by passing the elementsOptions and you create the Element. This renders the Elements to collect the PaymentMethod details.
Can you configure your page first and enusre it works without the additional steps like: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup#save-payment-methods ?
Once you get that page working, you can add more options.
Yeah I've got requires steps 1, 2 and 3 setup and working.
And I already understand how to accomplish required steps 4, 5 and 6 from having setup the flow the I first referenced that sets the setupIntent up right away.
Ok, now, since the Customer Session creation is a separate component, it is in checkout.js separate from checkout.js
You use the Customer Session's client secret there
What I thought this delayed method allowed me to do was to collect the payment info from the form in the first three steps and then to let them go back to my enrollment form flow and complete the rest of the required info for us and then at the end process the setupintent.
But you want to add the option to show the payment methods already saved, yeah?
Yeah
So as it stands now with up to step 3, what happens when they hit the submit button on the form?
When I test it I keep getting an error that says "There was a problem connecting your account. Please try again, or try a different payment method."
Can you share the specific request id where you see this error?
I do not fully understand what you're submitting as you'd need to create the SetupIntent, https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup#submit-the-setup and then click the submit button
Ok, so I guess maybe I'm misunderstanding what the delayed setupintent flow does. It only delays it to until they click the submit button, then it creates it then, as opposed to loading the paymentElement initially with the setupIntent already created. Is that correct?
IF that's correct, then what's the advantage of doing the delayed setupintent flow?
Yes, that is correct.
Also, that error message is just when I try to select a bank account to add. Not when I try to submit the form.
If you want to build a multi-page checkout or collect payment method details before running additional validations, see Build a two-step checkout flow. With this flow, you create a ConfirmationToken on the client to collect payment details and then use it to create a SetupIntent on the server.
The advantage would be not have to create the setupIntent first to render the Payment Element.
Can you share you full business use case so I can recommend what integration might be best suited?
Ok, maybe the two step method then is what I after. I'll take a look here... And with the two step I can just collect payment details and submit to Stripe and not have to charge but save for future payments?
Yes, https://docs.stripe.com/payments/build-a-two-step-confirmation#additional-options. However, you'd need to use SetupIntent here, https://docs.stripe.com/payments/build-a-two-step-confirmation#create-intent in your case.
It does not looke like I have a working example integration with this flow on my end
I only have one with the PaymentIntent
So does that mean it's not possible to use a setupIntent?
I do not see a reason as to why not but I'm trying to confirm this
K, thx
yeap, it should work.
At this stage, https://docs.stripe.com/payments/build-a-two-step-confirmation#create-intent you'd use SetupIntents, https://docs.stripe.com/payments/setup-intents instead
Under the Elements option, https://docs.stripe.com/payments/build-a-two-step-confirmation#additional-options you need to pass mode:setup as well
Right, I figured that, thx!
Ok, so basically when selecting submit then I'm just creating and capturing the confirmationToken, which I can then use later on a different page to create the setupIntent and confirm it?
Is the summary object returned when retrieving the summary something I have to render in a stripe element or is it just json that I can render however I want in my application?
What you show there is up to you, yes
So in this flow there isn't any redirection needed, like previously when the setupIntent was created?
Wait so the confirmation summary is actually still being rendered in the same paymentElement form that collects the payment info. So it seems like it all still happens before they hit the submit on the element form.
I was mainly trying to handle the case where the user backs out of the payment step, or decides they want to change the payment method before fullly submitting our registration form.
I might just put the payment step as the last one though since there seems to be a requirement to redirect and I'd rather not redirect back to the middle of an enrollment form for us. I guess I just don't know how they are going to submit the rest of the data we need on their application after the redirect.
You create the ConfrimationToken, https://docs.stripe.com/payments/build-a-two-step-confirmation#create-ct. Then, you inspect the data and you decide whether you want to create the SetupIntent: https://docs.stripe.com/payments/build-a-two-step-confirmation#create-intent
I do not follow your last question, can you reword it please?