Coder Social home page Coder Social logo

vue-stripe-checkout's Introduction

Vue Stripe Checkout

Circle CI NPM Buy Me A Coffee donate button

⚠️ BREAKING CHANGES SINCE 1.1.x ⚠️

  1. Initialization options now only accepts stripe publishable key. E.g. Vue.use(VueStripeCheckout, 'your-publishable-key-here').

  2. Global mixin $checkout was removed in favor of the component vue-stripe-checkout.


Shut up and clone my repo!

A Vue plugin for Stripe checkout. I sh*t you not, this plugin is the easiest to use.

Demo

Shut up and see the demo!

If you liked this repo then leave a ⭐, if not, I don't care. (Seriously leave a ⭐ please)

Screen Shot

Install

NPM or Yarn

npm install vue-stripe-checkout --save

yarn add vue-stripe-checkout

CDN

https://unpkg.com/vue-stripe-checkout/build/vue-stripe-checkout.js

Usage

import Vue from 'vue';
import VueStripeCheckout from 'vue-stripe-checkout';

Vue.use(VueStripeCheckout, 'your-publishable-key-here');

Just see the stripe docu for all of the available options.

Sample

<template>
  <div>
    <vue-stripe-checkout
      ref="checkoutRef"
      :image="image"
      :name="name"
      :description="description"
      :currency="currency"
      :amount="amount"
      :allow-remember-me="false"
      @done="done"
      @opened="opened"
      @closed="closed"
    ></vue-stripe-checkout>
    <button @click="checkout">Checkout</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      image: 'https://i.imgur.com/HhqxVCW.jpg',
      name: 'Shut up and take my money!',
      description: 'Cats are the best dog!',
      currency: 'PHP',
      amount: 99999
    }
  },
  methods: {
    async checkout () {
      const token = await this.$refs.checkoutRef.open();
    },
    done (token) {
      // do stuff
    },
    opened () {
      // do stuff 
    }
    closed () {
      // do stuff 
    }
  }
}
</script>

Props

See property description from official Stripe Documentation

  • publishable-key: String
  • image: String
  • name: String
  • description: String
  • amount: Number
  • locale: String
  • zip-code: Boolean
  • billing-address: Boolean
  • currency: String
  • panelLabel: String
  • shipping-address: Boolean
  • email: String
  • allow-remember-me: Boolean

Events

  • done - Emits the stripe token.
  • opened - Called when the stripe checkout dialog has been opened.
  • closed - Called when the stripe checkout dialog has been closed.

Usage

<vue-stripe-checkout
  @done="done"
  @opened="opened"
  @closed="closed"
></vue-stripe-checkout>

SPECIAL THANKS TO THE FOLLOWING SPONSOR(S):

MYCURE INC.

TEAM O.P.S. INC.

Made with ❤️ by Jofferson Ramirez Tiquez

vue-stripe-checkout's People

Contributors

jofftiquez avatar abuffseagull avatar posva avatar 512dev avatar lesion avatar lostlivio avatar ragesh-kannan avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.