# custom-paystack-js

> A custom version of Paystack's core javascript library

Latest version **2.0.0** (published 2019-05-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install custom-paystack-js
pnpm add custom-paystack-js
yarn add custom-paystack-js
bun add custom-paystack-js
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-05-24 |
| First published | 2019-05-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 55.8 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | custom user |
| Maintainers | customuser |

## Links

- npm: https://www.npmjs.com/package/custom-paystack-js
- npm.io page: https://npm.io/package/custom-paystack-js

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.17.1
- [is-mobile](https://npm.io/package/is-mobile.md) ^0.2.2
- [jsencrypt](https://npm.io/package/jsencrypt.md) ^3.0.0-rc.1
- [card-validator](https://npm.io/package/card-validator.md) ^4.2.0
- [form-urlencoded](https://npm.io/package/form-urlencoded.md) ^2.0.9

## Recent versions

- 2.0.0 (latest) — 2019-05-24
- 1.0.0 — 2019-05-24

## README

# Paystack JS

### Paystack's core javascript library.

It is composed of the following modules:
- [Transaction](docs/transaction.md)
- [Card](docs/card.md)
- [BankAccount](docs/bank-account.md)
- [Checkout](docs/checkout.md)
- [MobileMoney](docs/mobile-money.md)
- [QR](docs/qr.md)

## Installation
```shell
npm install paystack-js
```

## Basic Usage
```js
import { Transaction, Card } from 'paystack-js';

const requestData = {
  email: 'customer@email.com',
  amount: 100, // amount in kobo
  key: 'replace_with_your_public_key',
};

// Request a new transaction
const transaction = await Transaction.request(requestData); 

// Create a payment method instance that will be used e.g card
const card = new Card({ 
  number: '4084084084084081', 
  cvv: '408', 
  month: '12', 
  year: '20', 
});

// Payment method instances provide validation functions that
// you can use to check for validaty before setting payment method
if (card.isValid()) {
  try {
    transaction.setPaymentMethod('card', card);
  } catch(e) {
    console.log(e);
  }
}

// Charge the payment method
const chargeResponse = await transaction.chargeCard();

// Handle the charge response
if (chargeResponse.status === 'success') {
  alert('Payment completed!');
}

## Transaction
```Pending```

## Payment Methods
```Pending```

## Charge responses
```Pending```

## Analytics
```Pending```

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