<1kb Framework/Library agnostic paystack wrapper
npm install paystack-simple
import Paystack from "paystack-simple";
const paymentInstance = Paystack();
paymentInstance.init() // Optional - Fetch paystack script
paymentInstance.addOptions({
amount: 5000,
key: 'pk-xxxxx-xxxxxx',
email: '[email protected]',
})
paymentInstance.addOptions({
currency: 'NGN',
callback: (res) => {
// act on response
}
})
paymentInstance.pay() // Pay
import Paystack from "paystack-simple";
const paymentInstance = Paystack();
paymentInstance.init() // Optional - Fetch paystack script
paymentInstance.addOptions({
amount: 5000,
key: 'pk-xxxxx-xxxxxx',
email: '[email protected]',
})
paymentInstance.addOptions({
container: 'container-ID',
callback: (res) => {
// act on response
}
})
paymentInstance.pay() // Pay
import Paystack, { setGlobalConfig } from "paystack-simple";
setGlobalConfig({ key: 'pk-test-xxxx-xxxx' }) // Key has been set globally
paymentInstance.addOptions({ // No need to add it here
amount: 5000,
email: '[email protected]',
callback: (res) => {
// act on response
}
})
paymentInstance.pay() // Pay
- Less than 1kb
- Framework/Library agnostic
- Simple API
- Intellisense support