paystack-simple

0.0.5 • Public • Published

paystack-simple

Paystack-simple bundle size MIT NPM Build Status

<1kb Framework/Library agnostic paystack wrapper

INSTALLATION

npm install paystack-simple

USAGE

Basic Usage

import Paystack from "paystack-simple";
 
const paymentInstance = Paystack();
 
paymentInstance.init() // Optional - Fetch paystack script
 
paymentInstance.addOptions({
  amount: 5000,
  key: 'pk-xxxxx-xxxxxx',
  email: 'cutomeremail@mail.com',
})
 
paymentInstance.addOptions({
  currency: 'NGN',
  callback: (res) => {
    // act on response
  }
})
 
paymentInstance.pay() // Pay

Embed

import Paystack from "paystack-simple";
 
const paymentInstance = Paystack();
 
paymentInstance.init() // Optional - Fetch paystack script
 
paymentInstance.addOptions({
  amount: 5000,
  key: 'pk-xxxxx-xxxxxx',
  email: 'cutomeremail@mail.com',
})
 
paymentInstance.addOptions({
  container: 'container-ID',
  callback: (res) => {
    // act on response
  }
})
 
paymentInstance.pay() // Pay

Set GlobalConfig

import Paystack, { setGlobalConfig } from "paystack-simple";
 
setGlobalConfig({ key: 'pk-test-xxxx-xxxx' }) // Key has been set globally
 
paymentInstance.addOptions({ // No need to add it here
  amount: 5000,
  email: 'cutomeremail@mail.com',
  callback: (res) => {
    // act on response
  }
})
 
paymentInstance.pay() // Pay
 

What's Cool?

  • Less than 1kb
  • Framework/Library agnostic
  • Simple API
  • Intellisense support

Package Sidebar

Install

npm i paystack-simple

Weekly Downloads

7

Version

0.0.5

License

MIT

Unpacked Size

9.51 kB

Total Files

10

Last publish

Collaborators

  • ashinzekene