🔄
Vue 3 Ready
Built for Vue 3 with full Composition API support and modern Vue patterns.
<template>
<VueStripeProvider :publishable-key="publishableKey">
<VueStripeElements :client-secret="clientSecret">
<VueStripePaymentElement />
<button @click="handleSubmit">Pay</button>
</VueStripeElements>
</VueStripeProvider>
</template>
<script setup>
import {
VueStripeProvider,
VueStripeElements,
VueStripePaymentElement,
useStripe,
useStripeElements
} from '@vue-stripe/vue-stripe'
const publishableKey = 'pk_test_...'
const clientSecret = 'pi_..._secret_...'
const handleSubmit = async () => {
const { stripe } = useStripe()
const { elements } = useStripeElements()
const result = await stripe.value.confirmPayment({
elements: elements.value,
confirmParams: {
return_url: 'https://example.com/complete'
}
})
}
</script>