0.1.2 • Published 4 months ago
paystack-pay v0.1.2
Paystack
About
This provides easy access to paystack APIS. All are properly & fully tested. Available features include:
- Account: get balance, statement, transfers and transactions.
- Payment: create dynamic account.
- Tool: banks, resolve Bank account number, check transaction dtatus, check transfer Status.
- Transfer: initiate transfer to bank account.
- USSD: get ussd banks, generate ussd code for payment/collection.
Getting Started
Technologies · Installations · Usage · Components · Tests · Author
Technologies Used
- ESLint - A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript.
- Jest - Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications.
- Airbnb style guide was followed.
- TypeScript
Installations
Getting started
- You need to have your paystack secret key and NPM installed on your computer.
Setup
- Installing the project dependencies
Run the command below
$ npm install paystack-pay
Usage
$ const { Paystack } = require('paystack-pay');
$ const paystack = new Paystack('your-secret-key');
Components
Transaction
- Initiate transaction
paystack.transaction.initialize({ channels: ['card'], // not required ["card", "bank", "ussd", "qr", "mobile_money", "bank_transfer", "eft"] amount: 900, // required email: 'elon@musk.com', // required callback_url: 'your-callback-url', // required metadata: { userId: 1 }, // not required reference: 'your-unique-reference', // required })
- VERIFY TRANSACTION
paystack.transaction.verify('your-unique-reference',)
- CHARGE TRANSACTION AUTHORIZATION
paystack.transaction.chargeAuthorization({ authorization_code: 'AUTH_CODE'; //required email: 'youruser@musk.com', //required amount; // required // this is kobo metadata:{userId:303030},// required reference:'your-unique-reference' //not required })