Introducing the Paystack CLI
Set up, test, and manage your Paystack integration directly from the terminal.
As a developer, your most powerful tools - such as basic bash commands, version control and deployment tools - sit on your terminal. This is why weโre excited to announce the Paystack CLI to make it easier to set up, test, and manage your Paystack integrations right from your terminal.
You no longer have to switch between your code editor, Paystack Dashboard, API explorer and terminal just to test or debug your Paystack integration.
How to get started with the Paystack CLI
To get started, install the npm package by running this installation command on your terminal.
$ npm install -g @paystack-oss/dev-cli
Paystack CLI requires Node.js v8+ to run.
After installation, you simply run a $ paystack
command from your terminal, and you're good to go!
The Paystack CLI lets you:
- Ping your preset webhook URL with sample event data
- Tunnel Paystack events directly to your local server without installing third-party software
- Set up sample applications with fully integrated payment channels
- Interact with the Paystack API
Managing Webhooks
Whenever actions are carried out on your Paystack account, we trigger events which your application can listen and respond to. Before now, to implement webhook routes like these, you had to:
- Deploy your code to a publicly available URL
- Login to your Paystack Dashboard and set the webhook URL
- Make a test payment
- Review logs
With the Paystack CLI, all these steps are reduced to running a single command:
$ webhook listen localhost:8080/webhook
The CLI tunnels your test events to your local server running on port 8080, making it possible for you to run end-to-end tests on your Paystack integration while in development mode. You can also run health checks on your webhook URL by sending different sample event objects to your server. Simply run:
$ webhook ping --event transfer.success --domain test
This sends a sample transfer.success
event to your test webhook URL and returns the response.
Using the API
All Paystack endpoints are accessible via the Paystack CLI. To test the API, all request parameters should be passed as flags as shown below.
Initializing a transaction
To initialize a transaction, run:
$ transaction initialize --amount 1000 --email [email protected]
Output
Verifying a transaction
To verify a transaction, run:
$ transaction verify --reference T394541625653843 --domain live
Output
Got Questions?
The Paystack CLI is easy to use and built to help you save time and be more productive while integrating to Paystack. To see more of what you can do from your CLI, run: paystack --help
If you have any suggestion or question at all, don't hesitate to reach out to us here. We're happy to help!