#moistcode-elements-react-setup

1 messages ยท Page 1 of 1 (latest)

weary gyro
#

Can you share more specific details like your exact code?

regal loom
#

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',
        },
    },
    }}
/>
weary gyro
#

Thanks. React and Typescript are not my forte so trying to figure out what could cause this

regal loom
#

Not necessarily using TS. Using JSDocs to help with typing if that helps.

weary gyro
#
  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?
regal loom
#

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.

weary gyro
#

I have to run but @languid moss is taking over

regal loom
#

Have a great day!

languid moss
#

๐Ÿ‘‹

#

Hello there, give me some mins to catchup!

regal loom
#

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.

languid moss
#

Sure, then feel free to ping again when you need help!

regal loom
#

Will do, thanks ๐Ÿ™‚

languid moss
#

๐Ÿ‘‹ 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.