JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1939
  • Score
    100M100P100Q123563F
  • License MIT

Paystack API wrapper for Node

Package Exports

  • @paystack/paystack-sdk
  • @paystack/paystack-sdk/dist/index.js
  • @paystack/paystack-sdk/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@paystack/paystack-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Paystack Node Library

A Node client library for consuming the Paystack API

Prerequisite

Your need to create a Paystack account, if you don't have one already, to get your test and live secret keys.

Installation

npm install @paystack/paystack-sdk --save

Usage

Import and initialize the library:

const { Paystack } = require('@paystack/paystack-sdk')
const paystack = new Paystack("sk_test_xxxxxx")

paystack.transaction.initialize({email: "test@example.com", amount: 20000})
                    .then(response => console.log(response))
                    .catch(error => console.log(error))

Import and initialize the library using ES module with async/await:

import { Paystack } from '@paystack/paystack-sdk'
const paystack = new Paystack("sk_test_xxxxxx")

const initialize = async(email, amount) => {
  const response = await paystack.transaction.initialize({
    email,
    amount
  })

  console.log(response)
}

const email = 'test@example.com'
const amount = 2000
initialize(email, amount)

Typescript

import { Paystack } from '@paystack/paystack-sdk';
const paystack = new Paystack("sk_test_xxxxxx");

const initialize = async(email, amount) => {
  const response = await paystack.transaction.initialize({
    email,
    amount
  });

  console.log(response);
}

const email = 'test@example.com';
const amount = 2000;
initialize(email, amount);

Issues

Kindly open an issue if you discover any bug or have problems using this library.

License

This repository is made available under the MIT license. Kindly read the LICENSE file for more information.