# vue-cardswipe

> A Vue plugin for capturing data from magnetic card readers.

Latest version **0.1.12** (published 2022-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-cardswipe
pnpm add vue-cardswipe
yarn add vue-cardswipe
bun add vue-cardswipe
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2022-04-13 |
| First published | 2019-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 6.0 |
| Dependencies | 1 |
| Unpacked size | 69.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Wuori |
| Maintainers | wuori |
| Keywords | plugin, vue, vuejs, stripe, credit, swipe |

## Links

- npm: https://www.npmjs.com/package/vue-cardswipe
- Repository: https://github.com/wuori/vue-cardswipe
- Homepage: https://github.com/wuori/vue-cardswipe#readme
- Issues: https://github.com/wuori/vue-cardswipe/issues
- npm.io page: https://npm.io/package/vue-cardswipe

## Dependencies (1)

- [is-my-json-valid](https://npm.io/package/is-my-json-valid.md) ^2.20.0

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 0.1.12 (latest) — 2022-04-13
- 0.1.11 — 2020-04-13
- 0.1.10 — 2019-06-13
- 0.1.9 — 2019-05-21
- 0.1.8 — 2019-05-21
- 0.1.7 — 2019-05-21
- 0.1.6 — 2019-05-21
- 0.1.5 — 2019-05-21
- 0.1.4 — 2019-05-21
- 0.1.3 — 2019-05-21
- 0.1.2 — 2019-05-21
- 0.1.1 — 2019-05-21

## README

# vue-cardswipe

[![npm](https://img.shields.io/npm/v/vue-cardswipe.svg)](https://www.npmjs.com/package/vue-cardswipe)
[![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)

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

This plugin is a port from  the [CarlRaymond/jquery.cardswipe](https://github.com/CarlRaymond/jquery.cardswipe). Please view the repo for more detailed documentation.

[CardSwipe Demo](https://wuori.github.io/vue-cardswipe/example/)

Note: Demo requires a magnetic card reader to use.

## Installation

```sh
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.

```js
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](https://wuori.github.io/vue-cardswipe/example/) to see a working implementation.

## Credits

This plugin was originally a clone of [CarlRaymond/jquery.cardswipe](https://github.com/CarlRaymond/jquery.cardswipe). This instance simply ports the functionalities into a Vue plugin.

## :copyright: License

[MIT](http://opensource.org/licenses/MIT)

---
_Source: https://npm.io/package/vue-cardswipe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
