#surajkumar8781

1 messages · Page 1 of 1 (latest)

floral treeBOT
jovial snow
kind pagoda
#

Hi there, I don't think you need to specify a currency when creating a SetupIntent

jovial snow
#

Sorry i didn’t get your point, import {Elements} from '@stripe/react-stripe-js'; we are using Elements.

#

<Elements stripe={stripePromise} options={{ clientSecret, fields: { billingDetails: 'never' } }}> <CheckoutForm /> </Elements>

kind pagoda
#

I mean the fields isn't for <Elements> component, you should set fields on the <PaymentElement>'s options props.

jovial snow
#

Ohh thanks its working, i think document has to be updated, it create a confusion.

#

What is the use of field currency in case of creating SetupIntent through Stripe payment element? If we create a payment element for currency USD can we use it for payment in EUR?.

#

This way we are finding only relevant payment options so thats why are thinking to use it.

jovial snow
#

Yes

#

I know it make sense in case of paymentIntents but i would like to know the use case for setupIntent

kind pagoda
#

If you read the doc, it says conditionally required. You don't need to set the currency if the mode is setup

jovial snow
#

Yes i understand, but it also works for mode setup

#

so if we pass currency: 'usd' then only us options are visible to US and if we set currency: 'eur only Europe options are visible to us

kind pagoda
#

it's simply ignored in if mode = setup

#

what do you mean by Europe options?

jovial snow
#

mean sepa_debit

kind pagoda
#

And can you share you complete code?

jovial snow
#

For US its US Bank

#

yes

#

allow me 1 min

#

`import {useEffect, useState} from 'react';

import {Elements} from '@stripe/react-stripe-js';
import CheckoutForm from './CheckoutForm'

function Payment(props) {
const { stripePromise } = props;
const [ clientSecret, setClientSecret ] = useState('');

useEffect(() => {
// Create PaymentIntent as soon as the page loads
fetch("/create-payment-intent")
.then((res) => res.json())
.then(({clientSecret}) => setClientSecret(clientSecret));
}, []);

return (
<>
<h1>Payment</h1>
{clientSecret && stripePromise && (
<Elements stripe={stripePromise} options={{ clientSecret,
currency: 'usd',
}}>
<CheckoutForm />
</Elements>
)}
</>
);
}

export default Payment;
`

kind pagoda
#

OK, got it.

#

So the payment method options to be rendered are based on the currency that you set here. Since you set eur, the Payment Element will display the payment methods that supports eur currency

jovial snow
#

got it.

#

we are using subscription lets assume we saved a payment method using currency as EUR but we want to charge in USD is it possible?

kind pagoda
#

If the payment method that you collected doesn't work for USD, then you can't use this payment method for subscription.