🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@paystack/paystack-sdk

Package Overview
Dependencies
Maintainers
7
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paystack/paystack-sdk

Paystack API wrapper for Node

1.0.1
latest
npm
Version published
Weekly downloads
184
-16.36%
Maintainers
7
Weekly downloads
 
Created
Source

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.

Keywords

paystack

FAQs

Package last updated on 01 Nov 2022

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