Communicate with the Paystack API to initialize transaction, create plans, etc.
$ npm install machinepack-paystack --save// Initialize a transaction on your Paystack integration
const Paystack = require('machinepack-paystack')
Paystack.initializeTransaction({
apiKey: process.env.PAYSTACK_API_KEY,
email: 'customer@email.com',
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: 'customer@email.com',
amount: '20000'
}).exec(function (error, intializedTransaction) {
console.log(initializedTransaction)
})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 testAlternatively you can run tests by
PAYSTACK_API_KEY_FOR_TESTS=YOUR_PAYSTACK_TEST_API_KEY npm testThanks goes to these wonderful people (emoji key):
Omereshone Kelvin 🚇 |
haastrup elijah 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
