0.1.12 • Published 2 years ago

vue-cardswipe v0.1.12

Weekly downloads
158
License
MIT
Repository
github
Last release
2 years ago

vue-cardswipe

npm vue2

A Vue plugin for reading credit card data from magnetic swipe readers.

This plugin is a port from the CarlRaymond/jquery.cardswipe. Please view the repo for more detailed documentation.

CardSwipe Demo

Note: Demo requires a magnetic card reader to use.

Installation

yarn add vue-cardswipe
- OR -
npm install vue-cardswipe

Using this plugin

Adding vue-cardswipe to your application requires a few additional steps vs. other Vue plugins as it requires (at the very minimum) a success callback.

import Vue from 'vue';

import VueCardSwipe from 'vue-cardswipe';

Vue.use(VueCardSwipe);

new Vue({
  el: '#app',
  ...
  methods{
    handleSwipeSuccess(cardData){
        this.number = cardData.account;
        this.expiry = cardData.expMonth + '/' + cardData.expYear.slice(-2);  
    },
    cardSwipeInit: function(){
      this.$cardSwipe.init({
        success: this.handleSwipeSuccess
      });
    },
  },
  mounted(){
    this.cardSwipeInit();
  }
});

After installing, when you component is mounted a document listener for credit card input is added, then any resulting data is sent to your success callback.

View the advanced example to see a working implementation.

Credits

This plugin was originally a clone of CarlRaymond/jquery.cardswipe. This instance simply ports the functionalities into a Vue plugin.

:copyright: License

MIT

0.1.12

2 years ago

0.1.11

4 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago