#moistcode-elements-react-setup
1 messages ยท Page 1 of 1 (latest)
Yeah! Hopefully I didn't omit too much.
import {
PaymentElement,
useElements,
useStripe,
} from '@stripe/react-stripe-js';
...
let stripe = useStripe();
let elements = useElements();
...
let confirmSetupObject = await stripe.confirmSetup({
elements,
// TODO: Update this when we decide to start supporting redirect-based
// payment methods.
redirect: 'if_required',
confirmParams: {
/* eslint-disable-next-line camelcase */
payment_method_data: {
/* eslint-disable-next-line camelcase */
billing_details: {
name,
address: {
line1,
line2,
city,
state: region,
/* eslint-disable-next-line camelcase */
postal_code: postalCode,
country,
},
},
},
},
});
...
<PaymentElement
onChange={onCompleteChange}
options={{
fields: {
billingDetails: {
address: 'never',
},
},
}}
/>
Thanks. React and Typescript are not my forte so trying to figure out what could cause this
Not necessarily using TS. Using JSDocs to help with typing if that helps.
Overload 1 of 2, '(options: { elements: StripeElements; confirmParams?: Partial<ConfirmPaymentData> | undefined; redirect: "if_required"; }): Promise<SetupIntentResult>', gave the following error.
Type 'StripeElements' is missing the following properties from type 'StripeElements': update, create``` but that error is Typescript right?
Yup
Hmm. Tell you what. Don't pay much mind to this for now. I'm going to keep playing around with it and make sure it's not my editor being all wonky.
I have to run but @languid moss is taking over
Have a great day!
Hiya Orakaro! As I've stated, I'm gonna play around with this a bit more hoping that it's an error from how my editor is mapping my dependencies before I waste your time.
Sure, then feel free to ping again when you need help!
Will do, thanks ๐
๐ Just in case you coming back. We have tested on our side and couldn't reproduce. I think it could be problem if you try to call either add or update elsewhere, but not sure if you actually do that.
I found a (sorta) similar issue here: https://github.com/stripe/react-stripe-js/issues/47 The person asked just restarted his environment and it worked. Maybe it's a cache thing?