Skip to content

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

License

Notifications You must be signed in to change notification settings

haastrupea/machinepack-paystack

 
 

Repository files navigation

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!

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%