#dineshkumar6419
1 messages · Page 1 of 1 (latest)
hi!
i want confirmation from user form UI and then confirm the payment form stripe.js
form 3rd step i got error ,please advise me
what error did you get exactly? from using exactly what code?
IntegrationError: Invalid value for stripe.confirmPayment(): elements should have a mounted Payment Element or Express Checkout Element.
// Create and mount the Payment Element
stripeSubscription.paymentElement = stripeSubscription.stripeElements.create("payment");
stripeSubscription.paymentElement.mount("#payment-element");
stripeSubscription.stripe.confirmPayment({
elements,
confirmParams: {
return_url: stripeSubscription.getReturnURL()
}
// redirect: "if_required"
})
.then(function (result) {
});
Hi there 👋 looks like you're trying to pass a variable named elements to confirmPayment, but you seem to have your Elements instance stored in a variable named stripeSubscription.stripeElements. I believe you'll need to adjust what you're passing into confirmPayment to match the naming you're using.
I'm not sure I'm understanding the question. You can pass the ID of an already existing and setup Payment Method, yes, but you typically wouldn't use that alongside the Payment Element.
my question is create the subscrtion already saved card details/paymentmethod
when create subscription on server side incomplete stsatus and confirm from clint side with secretekey
You never use your secret key in client-side code, only your publishable key should be sent client-side.
Are you currently following one of our guides for building your Subscription integration?
Yes, i follewed your guides
Can you point me to which one so I have a better idea of the flow you have set up?
ok i will share
i followed this
Gotcha, so you won't already have a Payment Method to pass to confirmPayment with that approach. The Payment Method will be created as part of the confirmation request.
If you modify this to use the name that you gave your variable, I'd suspect it would run if there aren't any other issues. Something like:
elements: stripeSubscription.stripeElements,
confirmParams: {
return_url: stripeSubscription.getReturnURL()
}
// redirect: "if_required"
})
.then(function (result) {
});```