The Vue Stripe Plugin
Vue.js plugin for Stripe Object.
Maybe you don't need the checkout, or the elements. Maybe you just need to access the other methods provided by the Stripe JS SDK. This plugin will help you do that.
Install
Add the Stripe js sdk in the html head.
<head>
<script src="https://js.stripe.com/v3"></script>
</head>
Import and register the StripePlugin
plugin.
import Vue from 'vue';
import { StripePlugin } from '@vue-stripe/vue-stripe';
const options = {
pk: process.env.STRIPE_PUBLISHABLE_KEY,
stripeAccount: process.env.STRIPE_ACCOUNT,
apiVersion: process.env.API_VERSION,
locale: process.env.LOCALE,
};
Vue.use(StripePlugin, options);
This will give you access to this.$stripe
, Where this.$stripe
= window.Stripe(PUBLISHABLE_KEY, options)
.
With this, you can now access the Stripe methods like, .confirmCardPayment
, .confirmAlipayPayment
, and more. See here.
Example
Coming Soon
See the dev console, I printed thethis.$stripe
for your reference.