I am setting payment element using js by setupIntent. Currently, it shows all the methods in the element that has been enabled from stripe dashboard. how to show setup payment methods as per user location.
Below is the code that I folllowed.
<script>
const createSetupIntent = async(customerId) =>{
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
automatic_payment_methods: {
enabled: true,
allow_redirects: 'always'
}
});
setupIntentSecret = setupIntent.client_secret
}
const appearance = {
theme: 'stripe',
};
const options = {
clientSecret: setupIntentSecret,
appearance,
};
elements = stripe.elements(options);
paymentElement = elements.create("payment");
paymentElement.mount("#payment-element");
</script>
<html>
<div id="payment-element" ></div>
</html>
This code shows me the payment methods that has been enabled from stripe dashboard.
I have below questions here-
- How can we show methods as per user’s location?
- How to determine using setupIntent that which type of method details have been submitted?
- Do we always need to redirect to page while confirming setupIntent?