#sweetpotato8776

1 messages · Page 1 of 1 (latest)

royal quiverBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

ocean musk
#

Hello there. Can you share the code that throws the error?

#

Particularly the part that references elements2

neon orchid
#

const appearance2 = { /* appearance */ }

const googleElementOption = {
    mode: 'payment',
    amount:  totalOrderAmt, 
    currency: 'usd',
    appearance2
};

elements2 = stripe.elements(googleElementOption);    

expreeCheckoutElements = elements2.create('expressCheckout', options2);
expreeCheckoutElements.mount('#express-checkout-element');
expreeCheckoutElements.on('confirm', async (event) => {

    const {error: submitError} = await elements2.submit();
    if (submitError) {
        handleError(submitError);
        return;
    }

    // Create the PaymentIntent and obtain clientSecret
    const {error, paymentMethod} = await stripe.createPaymentMethod({
        elements2,
        params: {
            billing_details: billingDetail
        }
    });
#

i think stripe.createPaymentMethod() not working

#

because paymentMethod response is undefined

ocean musk
#

Hmnm, not entirely sure you can use createPaymentMethod with ECE

#

What exactly are you trying to do?

ocean musk
#

Ah, ok. My bad

#

What do you see that error? Does the Element mount and are you able to see/click the wallet buttons?

neon orchid
#

Can I use it in ECE?

ocean musk
neon orchid
#

i able to mount the button, but When I click the pay button in my GPay pop-up, an error occurs.

#

The id of element2 is as follows. Is there anything you can confirm?

_id: "elements-d2593052-c0cb-4070-bd18-581b450b5d9f-7969"

#

It seems to work up to elements2.submit();

ocean musk
#

Which version of @stripe/stripe-js are you using?

neon orchid
#

Where can I see it?

ocean musk
#

All good. Where in your code do you actually define your elements2 variable?

#

All I can see is you reassigning the value:

elements2 = stripe.elements(googleElementOption);
neon orchid
#

at the top
let elements2;
It is only declared.

ocean musk
#

Can you change it to a const?

neon orchid
#

const googleElementOption = {
mode: 'payment',
amount: totalOrderAmt, //google/app pay 표시용
currency: 'usd',
appearance2
};

const elements2 = stripe.elements(googleElementOption);
#

same error occred..

#

When using Google Pay createPaymentMethod, is there a required value among billing addresses?

ocean musk
#

Is there somewhere I can reproduce this? Paste the URL please

neon orchid
#

It's still in development and only available locally.

#

ㅠㅠㅠㅠㅠ

#

Can't I find a way using another ID or call?

ocean musk
#

Oh, I can't believe I missed this

#

You need to change your code to be:

const {error, paymentMethod} = await stripe.createPaymentMethod({
            elements: elements2,
            params: {
                billing_details: billingDetail
            }
        });
#

elements2 is not a valid parameter 🤦‍♂️

neon orchid
#

!?!?!?!?

ocean musk
#

Did you try and update the code?

neon orchid
#

Then what should I do?

ocean musk
#

Update the code to the snippet I just shared

#

elements is the parameter, not elements2. You want to pass your elements2 variable as an agument:

elements: elements2
neon orchid
#

WOw...........bbb

#

bbbbbbbbbbbbbbbbbbbb

#

Thank you so much....why isn't it stated that way in the document?

#

ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

ocean musk
#

Well, it is

neon orchid
ocean musk
#

You're just using a different name (elements2) for your variable

ocean musk
# neon orchid

If the argument and parameters names are the same (elements) you can pass it like that

#

Basic JavaScript syntax

#

But your argument differs to the parameter name so you need to be explicit

neon orchid
#

oh isee............thank you..................