#sweetpotato8776
1 messages · Page 1 of 1 (latest)
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.
- sweetpotato8776, 44 minutes ago, 80 messages
- sweetpotato8776, 6 hours ago, 34 messages
Hello there. Can you share the code that throws the error?
Particularly the part that references elements2
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
Hmnm, not entirely sure you can use createPaymentMethod with ECE
What exactly are you trying to do?
Ah, ok. My bad
What do you see that error? Does the Element mount and are you able to see/click the wallet buttons?
Can I use it in ECE?
Seems so, yes. But it's not a requirement which is why I asked what it is you're trying to do exactly
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();
Which version of @stripe/stripe-js are you using?
Where can I see it?
i just include script https://js.stripe.com/v3/
like this <script type="text/javascript" src="https://js.stripe.com/v3/"></script>
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);
at the top
let elements2;
It is only declared.
Can you change it to a const?
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?
Is there somewhere I can reproduce this? Paste the URL please
It's still in development and only available locally.
ㅠㅠㅠㅠㅠ
Can't I find a way using another ID or call?
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 🤦♂️
!?!?!?!?
Did you try and update the code?
Then what should I do?
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
WOw...........bbb
bbbbbbbbbbbbbbbbbbbb
Thank you so much....why isn't it stated that way in the document?
ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
Well, it is
You're just using a different name (elements2) for your variable
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
oh isee............thank you..................