Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 3.16 KB

README.md

File metadata and controls

75 lines (60 loc) · 3.16 KB

All Contributors

node-machine logo machinepack-paystack

Communicate with the Paystack API to initialize transaction, create plans, etc.

Installation

$ npm install machinepack-paystack --save

Usage

// Initialize a transaction on your Paystack integration
const Paystack = require('machinepack-paystack')
 Paystack.initializeTransaction({
      apiKey: process.env.PAYSTACK_API_KEY,
      email: '[email protected]',
      amount: '20000'
    }).exec(function (error, intializedTransaction) {
     console.log(initializedTransaction)
    })

machinepack-paystack expects your Paystack secret for convenience to be in your environment as PAYSTACK_API_KEY so the above can be written as:

// Initialize a transaction on your Paystack integration
const Paystack = require('machinepack-paystack')
 Paystack.initializeTransaction({
      email: '[email protected]',
      amount: '20000'
    }).exec(function (error, intializedTransaction) {
     console.log(initializedTransaction)
    })

Test

To run the test in this machine, rename env.example to .env then replace the content with your Paystack test API Key Now run test simpley with:

npm test

Alternatively you can run tests by

PAYSTACK_API_KEY_FOR_TESTS=YOUR_PAYSTACK_TEST_API_KEY npm test

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Omereshone Kelvin

🚇 ⚠️ 💻

haastrup elijah

💻 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!