Paystack
Nodejs API wrapper for Paystack.
Installation
npm install paystack
Usage
// Require the libraryvar paystack = 'secret_key';
Making calls to the resources
The resource methods accepts are promisified, but can receive optional callback as the last argument.
// First Option// paystack.{resource}.{method}paystackcustomer;
// Second Option// paystack.{resource}paystackcustomer ;
For resource methods that use POST or PUT, the JSON body can be passed as the first argument.
paystackplan ;
For GET, you can pass the required ID as string and optional parameters as an optional object argument.
paystackplan ;
paystacktransactions ;
Resources
- customer
- create
- get
- list
- update
- transaction
- initialize
- charge
- get
- list
- totals
- verify
- plan
- create
- get
- list
- update
- page
- create
- get
- list
- update
- subscription
- create
- disable
- enable
- get
- list
- subaccount
- create
- get
- list
- listBanks
- update
- Miscellanous
- list_banks
- resolve_bin
Contributing
- To ensure consistent code style, please follow the editorconfig rules in .editorconfig
Tests
To run tests, add your Paystack test secret key to package.json
. (The test line should look something like this: env KEY=sk_test_1a68ac96a0171fb72111a24295d8d31d41c28eed ./node_modules/.bin/mocha...
). Now run:
npm test
If you are contributing to the repo, kindly update the necessary test file in /test
or add a new one and ensure all tests are passed before sending a PR.
Todo
- Proper resource examples
- ES6 support