# payment-tools

> Payment field validators and formatters

Latest version **1.0.9** (published 2016-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install payment-tools
pnpm add payment-tools
yarn add payment-tools
bun add payment-tools
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2016-09-21 |
| First published | 2016-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joseph Dalrymple |
| Maintainers | swivel |
| Keywords | payment, cc, card |

## Links

- npm: https://www.npmjs.com/package/payment-tools
- Repository: https://github.com/Swivelgames/payment-tools
- Homepage: https://github.com/Swivelgames/payment-tools#readme
- Issues: https://github.com/Swivelgames/payment-tools/issues
- npm.io page: https://npm.io/package/payment-tools

## Recent versions

- 1.0.9 (latest) — 2016-09-21
- 1.0.8 — 2016-09-20
- 1.0.7 — 2016-09-20
- 1.0.6 — 2016-09-20
- 1.0.5 — 2016-09-20
- 1.0.4 — 2016-09-20
- 1.0.3 — 2016-09-20
- 1.0.2 — 2016-09-20
- 1.0.1 — 2016-09-20
- 1.0.0 — 2016-09-20

## README

### Usage

In your project folder
```bash
npm install --save payment-tools
```

### Format Credit Card Field Example

```javascript
el.addEventListener('keyup', (e) => {
	var key = event.keyCode || event.charCode;
	if (key === 8 || key === 46) return;
	el.value = PaymentTools.formatCCNum(el.value);
});

el.addEventListener('keyup', (e) => {
	var key = event.keyCode || event.charCode;
	if (key === 8 || key === 46) return;
	el.value = PaymentTools.formatCCExp(el.value);
});

el.addEventListener('keyup', (e) => {
	var key = event.keyCode || event.charCode;
	if (key === 8 || key === 46) return;
	el.value = PaymentTools.formatCCCVV(el.value);
});
```

### Available Functions

```javascript
import * as PaymentTools from 'payment-tools';

PaymentTools.formatCCNum(num);
PaymentTools.formatCCExp(exp);
PaymentTools.formatCCCVV(cvv, type);

PaymentTools.validateCCNum(num);
PaymentTools.validateCCExp(exp);
PaymentTools.validateCCCVV(cvv, type);

PaymentTools.getCard(num);
PaymentTools.getType(num);
```

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