A Node client library for consuming the Paystack API
Your need to create a Paystack account, if you don't have one already, to get your test and live secret keys.
npm install @paystack/paystack-sdk --save
Import and initialize the library:
const { Paystack } = require('@paystack/paystack-sdk')
const paystack = new Paystack("sk_test_xxxxxx")
paystack.transaction.initialize({email: "[email protected]", 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 = '[email protected]'
const amount = 2000
initialize(email, amount)
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 = '[email protected]';
const amount = 2000;
initialize(email, amount);
Kindly open an issue if you discover any bug or have problems using this library.
This repository is made available under the MIT license. Kindly read the LICENSE file for more information.