#delgesu1745_api

1 messages ¡ Page 1 of 1 (latest)

hallow carbonBOT
#

👋 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.

pastel violet
#

This is just to capture payment method via a setupIntent to store card for later use.

balmy valley
#

Hi! Which element are you trying to prefill?

pastel violet
#

email address

#

when someone selects bank account option

balmy valley
#

What Stripe Element are you creating which has a bank account option for them to select?

hallow carbonBOT
floral geyser
#

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?

hallow carbonBOT
pastel violet
#

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

floral geyser
#

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

pastel violet
#

Yes that's correct. Ok, gotcha.

#

And the stripe specific screens that open up when you select bank account, you can't style those?

floral geyser
#

You mean the authentication UIs for specific banks? If yes, those are owned by the financial institutions in question

pastel violet
#

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?

floral geyser
#

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?

pastel violet
#

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?

floral geyser
#

which specific step in the guide are you referring to?

pastel violet
#

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

floral geyser
#

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

pastel violet
#

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

floral geyser
pastel violet
#

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?

floral geyser
#

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