vue-cardswipe

A Vue plugin for capturing data from magnetic card readers.
7,335
Install
npm install vue-cardswipe
Latest Version:0.1.12
Vue:2
License:MIT
Last Updated:May 1, 2023
Links: GitHub  ·  npm
Maintainer: wuori

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

Related Packages

vue-credit-card-validation

A Vue plugin for formatting and validating credit card forms to offer the same f...

222,235 51
@21cnfe/onekit-mp-cli

小程序框架开发工具

1,154
duplicate-dependencies-webpack-plugin

webpack plugin to find duplicated dependencies from your bundle

332,104 6
@debut/plugin-report

Report generation for strategy backtesting in debut

4,011 18
@amilochau/core-vue3

Core plugin for vue.js (v3) projects

3,802 0

Version History

Version Released Vue License
0.1.12 ^2.6.10 MIT
0.1.11 ^2.6.10 MIT
0.1.10 ^2.6.10 MIT
0.1.9 ^2.6.10 MIT
0.1.8 ^2.6.10 MIT