paystack package written in TypeScript
npm install paystack-pay> Technologies · Installations · Usage · Components · Tests · Author
#### Getting started
- You need to have your paystack secret key and NPM installed on your computer.
#### Setup
- Installing the project dependencies
> Run the command below
``shell`
$ npm install paystack-pay
shell
$ const { Paystack } = require('paystack-pay');
$ const paystack = new Paystack('your-secret-key');
`Components
- Transaction
- Initiate transaction
` javascript
paystack.transaction.initialize({
channels: ['card'], // not required ["card", "bank", "ussd", "qr", "mobile_money", "bank_transfer", "eft"]
amount: 900, // required
email: 'elon@musk.com', // required
callback_url: 'your-callback-url', // required
metadata: { userId: 1 }, // not required
reference: 'your-unique-reference', // required
})
`
- VERIFY TRANSACTION
` javascript
paystack.transaction.verify('your-unique-reference',)
`
- CHARGE TRANSACTION AUTHORIZATION
` javascript
paystack.transaction.chargeAuthorization({
authorization_code: 'AUTH_CODE'; //required
email: 'youruser@musk.com', //required
amount; // required // this is kobo
metadata:{userId:303030},// required
reference:'your-unique-reference' //not required
})
``