npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-stripe

v3.1.0

Published

Vue components for Stripe.js and Stripe Elements

Readme

vue-stripe

Vue components for Stripe.js and Elements with full TypeScript support.

[!NOTE] The aim of this module is to have @stripe/react-stripe-js for Vue with feature parity. You should be able to follow the React docs and examples using this module. Only use this library if you want parity with the React Stripe.js SDK. Otherwise, consider using the Stripe Partner Vue SDK.

Getting started

Installation

npm install vue-stripe @stripe/stripe-js

[!IMPORTANT] Vue Stripe requires @stripe/stripe-js v9.16 or newer, below v10. Upgrading from v2? See the migration guide.

Build a custom checkout page

For a new custom checkout page, we recommend the Checkout Sessions API with ui_mode: 'elements'. You place Stripe Elements in your own Vue layout, and the Checkout Session manages the checkout state. The lower-level Payment Intents API gives you control over every part of your checkout. It also takes much more code to build and maintain. For a Payment Intents example in Vue, see the Payment Element docs.

Create a Checkout Session on your server from trusted product and pricing data. Then return its client secret.

const session = await stripe.checkout.sessions.create({
  ui_mode: 'elements',
  mode: 'payment',
  return_url: 'https://example.com/order/123/complete',
  line_items: [
    {
      price_data: {
        currency: 'usd',
        product_data: { name: 'T-shirt' },
        unit_amount: 1099,
      },
      quantity: 1,
    },
  ],
})

if (!session.client_secret) {
  throw new Error('Checkout Session is missing a client secret.')
}

res.json({ clientSecret: session.client_secret })

On the client, import from vue-stripe/checkout. useCheckoutElements() returns a computed ref holding a loading, success, or error result.

CheckoutForm.vue

<script setup>
import { ref } from 'vue'
import { PaymentElement, useCheckoutElements } from 'vue-stripe/checkout'

const result = useCheckoutElements()
const errorMessage = ref(null)
const isSubmitting = ref(false)

async function handleSubmit() {
  if (result.value.type !== 'success' || !result.value.checkout.canConfirm) {
    return
  }

  isSubmitting.value = true
  errorMessage.value = null

  try {
    const confirmResult = await result.value.checkout.confirm({
      returnUrl: 'https://example.com/order/123/complete',
    })

    if (confirmResult.type === 'error') {
      errorMessage.value = confirmResult.error.message
    }
  }
  catch (error) {
    errorMessage.value = error instanceof Error
      ? error.message
      : 'An unexpected error occurred.'
  }
  finally {
    isSubmitting.value = false
  }
}
</script>

<template>
  <div v-if="result.type === 'loading'">
    Loading checkout...
  </div>
  <div v-else-if="result.type === 'error'">
    {{ result.error.message }}
  </div>
  <template v-else>
    <ul>
      <li v-for="lineItem in result.checkout.lineItems" :key="lineItem.id">
        {{ lineItem.name }}: {{ lineItem.total.amount }}
      </li>
    </ul>
    <p>Total: {{ result.checkout.total.total.amount }}</p>
    <form @submit.prevent="handleSubmit">
      <PaymentElement />
      <button type="submit" :disabled="!result.checkout.canConfirm || isSubmitting">
        {{ isSubmitting ? 'Processing...' : 'Pay' }}
      </button>
      <div v-if="errorMessage">
        {{ errorMessage }}
      </div>
    </form>
  </template>
</template>

App.vue

<script setup>
import { loadStripe } from '@stripe/stripe-js'
import { CheckoutElementsProvider } from 'vue-stripe/checkout'
import CheckoutForm from './CheckoutForm.vue'

const stripePromise = loadStripe('pk_test_...')

const clientSecretPromise = fetch('/create-checkout-session', {
  method: 'POST',
}).then(async (response) => {
  const body = await response.json()

  if (!response.ok) {
    throw new Error(body.error ?? 'Unable to create a Checkout Session.')
  }

  return body.clientSecret
})

const options = {
  clientSecret: clientSecretPromise,
  elementsOptions: {
    appearance: {
      theme: 'stripe',
    },
  },
}
</script>

<template>
  <CheckoutElementsProvider :stripe="stripePromise" :options="options">
    <CheckoutForm />
  </CheckoutElementsProvider>
</template>

Acknowledgements

This project builds upon the foundation laid by several Vue Stripe integration libraries:

  • vue-stripe - Vue.js 2 Stripe checkout component. Special thanks to @matfish2 for graciously transferring the vue-stripe package name to enable this project.
  • vuestripe.com - Stripe Checkout & Elements for Vue.js (Stripe Verified Partner)
  • vue-stripe-js - Vue 3 components for Stripe

While these libraries provide valuable solutions, this project aims to deliver a comprehensive 1:1 equivalent to the React Stripe SDK with complete tests.

License

MIT