paystack-simple
v0.0.5
Published
A Framework/Library agnostic paystack wrapper
Downloads
16
Maintainers
Readme
paystack-simple
<1kb Framework/Library agnostic paystack wrapper
INSTALLATION
npm install paystack-simple
USAGE
Basic Usage
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
Embed
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
Set GlobalConfig
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
What's Cool?
- Less than 1kb
- Framework/Library agnostic
- Simple API
- Intellisense support