Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paystack-js

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paystack-js

Paystack's core javascript library

  • 0.18.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Paystack JS

Paystack's core javascript library.

It is composed of the following modules:

  • Transaction
  • Card
  • BankAccount
  • Checkout
  • MobileMoney
  • QR

Installation

npm install paystack-js

Basic Usage

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



Keywords

FAQs

Package last updated on 18 Nov 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc