Closed mattcookdev closed 3 years ago
For anyone stuck on this, you can access it from the Stripe instance returned from the package while you're waiting for this to be made available directly.
import { instance as StripeInstance } from "vue-stripe-elements-plus";
StripeInstance.confirmCardPayment();
This is working currently
import { instance as StripeInstance } from "vue-stripe-elements-plus";
.....
.....
StripeInstance.confirmCardPayment(paymentIntent.client_secret, {
payment_method: {
card: this.$refs.stripeCard.$refs.element._element,
billing_details: {
name: paymentIntent.user_name,
email: paymentIntent.user_email_address
}
}
}).then(result => {
console.log(result);
if (result.error) {
// Show error to your customer (e.g., insufficient funds)
console.log(result.error.message);
} else {
// The payment has been processed!
if (result.paymentIntent.status === "succeeded") {
// Show a success message to your customer
// There's a risk of the customer closing the window before callback
// execution. Set up a webhook or plugin to listen for the
// payment_intent.succeeded event that handles any business critical
// post-payment actions.
}
}
});
}
For v1.0.0:
const StripeElements = this.$refs.elms // vue component instance
StripeElements.instance.confirmCardPayment()
https://stripe.com/docs/payments/accept-a-payment#web-submit-payment
confirmPaymentIntent
got deprecated and nowconfirmCardPayment
has replaced it.