Socket
Socket
Sign inDemoInstall

vue-cardswipe

Package Overview
Dependencies
7
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-cardswipe

A Vue plugin for capturing data from magnetic card readers.


Version published
Maintainers
1
Install size
167 kB
Created

Readme

Source

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.

MIT

Keywords

FAQs

Last updated on 13 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc