#kaustuva-le
1 messages · Page 1 of 1 (latest)
Hi there, PaymentIntent's payment_method_types would tell you want payment methods are avaible for this payment.
I would like to have the information just before I reach my checkout to additionally show/not show certain elements based on which payment methods are available. I guess the payment intent wouldn't have been created at this point of time?
The PaymentIntent should be created before rendering the PaymentElement, unless you are using the deferred flow? https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment
How does the payment element know which methods to show?
if we render first and create payment intent later
At Step 3 of above deferred intent doc, Payment Element will be able to determine the payment methods based on the amount, currency and mode set in the options of elements config. More specifically, this block of codes:
const options = {
mode: 'payment',
amount: 1099,
currency: 'usd',
// Fully customizable with appearance API.
appearance: {/*...*/},
};
// Set up Stripe.js and Elements to use in checkout form
const elements = stripe.elements(options);
How does it know which methods to show for the currency?
e.g. for USD, I could have two connect accounts which receive USD, one for hotels and one for flights.
Afterpay could be enabled on the connect account for hotels but not flights. How would the payment element know in this case?
Which type of connected account do you use? Standard, Express or Custom?
Standard
With Standard connected account, stripe instance will be initialised with connected account ID under stripeAccount. It will be used to determine the payment methods configured on each account respectively: https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application
What's the API function to get the payment methods from the stripeAccount object?
Can you share what you would like to achieve? What is the purpose of getting payment methods?
We want to consider a solution where we have our own accordions with a payment method.
Once the user selects it, it displays a payment element with that one method only.
But for this we need to know what payment methods are available so we do not show an accordion which is blank inside.