Vue Stripe
HomeGitHubTwitterOSSPHP
Vue 2 Version
Vue 2 Version
  • 🎊Welcome!
  • 💳Stripe Checkout
    • Getting Started
    • One-time Payment
    • Subscriptions
    • Sessions
    • Sessions Generator
    • Google & Apple Pay
  • 💸Stripe Elements
    • Getting Started
    • Separate Card Fields
    • Card
    • Payment
  • 🔌Vue Stripe Plugin
  • 🫂Community
  • Others
    • 💜Partners
Powered by GitBook
On this page
  • Demo
  • 1. Enable Checkout
  • 2. Create products and prices
  • 3. Redirect to checkout

Was this helpful?

Edit on GitHub
Export as PDF
  1. Stripe Checkout

One-time Payment

Vue Stripe Checkout also supports one-time card payments.

PreviousGetting StartedNextSubscriptions

Last updated 3 years ago

Was this helpful?

Demo

1. Enable Checkout

You must first enable the client-only integration settings in your Stripe dashboard, you also have the option to customize the look and feel of your checkout page. .

2. Create products and prices

Product and Price are required to make this work. Whether it's a physical item or a service, it needs to be represented by a product. Each product can have one or more prices.

For example, you can create a T-shirt product, with different prices for different currencies. $20 USD and €15 Euro. .

3. Redirect to checkout

Follow the Vue Stripe Checkout example below:

<template>
  <div>
    <stripe-checkout
      ref="checkoutRef"
      mode="payment"
      :pk="publishableKey"
      :line-items="lineItems"
      :success-url="successURL"
      :cancel-url="cancelURL"
      @loading="v => loading = v"
    />
    <button @click="submit">Pay now!</button>
  </div>
</template>

<script>
import { StripeCheckout } from '@vue-stripe/vue-stripe';
export default {
  components: {
    StripeCheckout,
  },
  data () {
    this.publishableKey = process.env.STRIPE_PUBLISHABLE_KEY;
    return {
      loading: false,
      lineItems: [
        {
          price: 'some-price-id', // The id of the one-time price you created in your Stripe dashboard
          quantity: 1,
        },
      ],
      successURL: 'your-success-url',
      cancelURL: 'your-cancel-url',
    };
  },
  methods: {
    submit () {
      // You will be redirected to Stripe's secure checkout page
      this.$refs.checkoutRef.redirectToCheckout();
    },
  },
};
</script>
💳
Live Demo
More details
More details