#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/1356674173644050454
đ 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, 12 hours ago, 16 messages
- delgesu1745_api, 22 hours ago, 26 messages
This is just to capture payment method via a setupIntent to store card for later use.
Hi! Which element are you trying to prefill?
What Stripe Element are you creating which has a bank account option for them to select?
Hi there! Stepping in for my colleague here
Are you having any specific problem trying to prefill email or you just are looking for help understanding how to do it?
You need to use this parameter when creating the Payment Element: https://docs.stripe.com/js/elements_object/create_payment_element#payment_element_create-options-defaultValues-billingDetails-email
The code above is what I tried and it's not working.
The code in the question itself for what I tried I mean.
Based on the article you sent.
The link you sent is a restricted corp one btw
Ah, I see, you were specifically looking to prefill the email address section when someone selects US bank account, is that right? If yes, that doesn't seem to be possible currently
Yes that's correct. Ok, gotcha.
And the stripe specific screens that open up when you select bank account, you can't style those?
You mean the authentication UIs for specific banks? If yes, those are owned by the financial institutions in question
This here.
And if someone selects the credit card tab, can we display information that there will be a processing fee if card is chosen?
Where can we show things like our terms?
The Payment Element itself can be styled with the Elements Appearance API as detailed here: https://docs.stripe.com/elements/appearance-api
however, in livemode, when paying by bank account, the customer would then enter their financial institution's authentication UI and Stripe doesn't have influence over that
You can't display custom text on the Payment Element. You would have to include things like your terms outside of it
Is this on web/mobile web or is that the mobile Payment Element?
It's on web/mobile.
So I'm also having some trouble with the next step in that guide I linked to where you confirm the intent was completed.
export const PaymentStatus = () => {
const stripe = useStripe();
const [message, setMessage] = useState(null);
useEffect(() => {
if (!stripe) {
return;
}
// Retrieve the "setup_intent_client_secret" query parameter appended to
// your return_url by Stripe.js
const clientSecret = new URLSearchParams(window.location.search).get(
'setup_intent_client_secret'
);
// Retrieve the SetupIntent
stripe
.retrieveSetupIntent(clientSecret)
.then(({setupIntent}) => {
// Inspect the SetupIntent `status` to indicate the status of the payment
// to your customer.
//
// Some payment methods will [immediately succeed or fail][0] upon
// confirmation, while others will first enter a `processing` state.
//
// [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
switch (setupIntent.status) {
case 'succeeded':
setMessage('Success! Your payment method has been saved.');
break;
case 'processing':
setMessage("Processing payment details. We'll update you when processing is complete.");
break;
case 'requires_payment_method':
// Redirect your user back to your payment page to attempt collecting
// payment again
setMessage('Failed to process payment details. Please try another payment method.');
break;
}
});
}, [stripe]);
return (
<Elements>
<NativeText style={{fontSize: 48}}>{message}</NativeText>
</Elements>
);
What can I do with that setupintent client secret? Is it the same one as the original created when opening the playment element?
which specific step in the guide are you referring to?
If I want to display that message on the page from redirect, am I returning the right thing with the <Elements>
Um it's no 6 I think
Second half of 6: PaymentStatus.jsx
You don't need to do anything with the SetupIntent client secret in this component unless you want to retrieve the SetupIntent from the component
but yes, it would be the same SetupIntent client secret you used to create the Payment Element
So the payment element I have in a modal and all I'd like to do after the submit button is check that it was successful and then close the modal and update the screen they were just.
on
But according to the docs, there has to be a redirect.
For dynamic payment options like bank
The other option there is to turn off payment methods that require a redirect if you prefer not to allow that: https://docs.stripe.com/api/setup_intents/create#create_setup_intent-automatic_payment_methods-allow_redirects
But we want to offer bank account, so I guess on redirect we would need to have saved the state of the screen below it in storage and reload the page, or what is normally done here?
Well, if you don't want to redirect for payments that don't require it, we do provide a parameter for that that you can pass when confirming the SetupIntent: https://docs.stripe.com/js/setup_intents/confirm_setup
So you can take the approach you're inclined to take when possible and then separately do something similar on a confirmation page for payments that require redirect
Stripe JS will append the SetupIntent's client secret to the query params so you can retrieve it clientside when you get to your return URL