@paystack-oss/dev-cli

1.0.0-nightly.0 • Public • Published

dev-cli

Paystack Logo

The Paystack CLI helps you build, test, and manage your Paystack integration right from the terminal.

With the Paystack CLI, you can:

Securely test webhooks without relying on third-party tunneling software Trigger webhook events to easily test your integration Create, retrieve, update, and delete API objects Clone real life sample applications with fully integrated payment channels.

And of course the Paystack CLI is open source with a public repository on GitHub. Contributions, features, sample apps from developers are encouraged.

Installation

Paystack requires Node.js v12+ to run.

Install the dependencies and devDependencies and start the instance.

$ npm install -g @paystack-oss/dev-cli
$ paystack
$ login

Get started

API

Paystack CLI allows you to make API calls to the Paystack API right from the terminal, for example to initialize a transaction, run

$ transaction initialize --amount 1000 --email customer@email.com

The terminal's output would look like this

authorization_url - - - -- - -- - - - - - -  - - - -  - https://checkout.paystack.com/9wvzhxlk66uylzp
access_code - - - -- - -- - - - - - -  - - - -  - 9wvzhxlk66uylzp
reference - - - -- - -- - - - - - -  - - - -  - se8b1ty80b

Another example

$ transaction verify --reference T394541625653843 --domain live

output

id - - - -- - -- - - - - - -  - - - -  - 521587687
domain - - - -- - -- - - - - - -  - - - -  - live
status - - - -- - -- - - - - - -  - - - -  - success
reference - - - -- - -- - - - - - -  - - - -  - T394541625653843
amount - - - -- - -- - - - - - -  - - - -  - 100000
gateway_response - - - -- - -- - - - - - -  - - - -  - Approved
paid_at - - - -- - -- - - - - - -  - - - -  - 2020-02-27T17:28:14.000Z
created_at - - - -- - -- - - - - - -  - - - -  - 2020-02-27T17:27:31.000Z
channel - - - -- - -- - - - - - -  - - - -  - card
currency - - - -- - -- - - - - - -  - - - -  - NGN
ip_address - - - -- - -- - - - - - -  - - - -  - 102.67.15.8
fees - - - -- - -- - - - - - -  - - - -  - 1500
plan - - - -- - -- - - - - - -  - - - -  - PLN_q34mm97ac7pnqj1
paidAt - - - -- - -- - - - - - -  - - - -  - 2020-02-27T17:28:14.000Z
createdAt - - - -- - -- - - - - - -  - - - -  - 2020-02-27T17:27:31.000Z
requested_amount - - - -- - -- - - - - - -  - - - -  - 100000
transaction_date - - - -- - -- - - - - - -  - - - -  - 2020-02-27T17:27:31.000Z

Webhook

You can tunnel Paystack webhook events directly to your localhost without any third party software directly from your terminal

 $ webhook listen localhost:8995/pay/pstk-webhook?country=ng

output

> Tunelling webhook events to localhost:8995/pay/pstk-webhook?country=ng
> Webhook events would now be received at localhost:8995/pay/pstk-webhook?country=ng

NOTE - This command is only avalaible in test mode, and by using this command, the CLI would automatically make changes to the Test Webhook URL set on your Paystack dashboard.

You can also run an health check on your live/test webhook endpoint from your terminal

$ webhook ping --domain live

output

-  - - - - - - -  - - -  - - - -   - - - --  -- - - - - - - 
Sending sample charge.success event payload to https://paycash.pstk.xyz/pay/pstk-webhook?country=ng
401 - - Unauthorized
Unauthorized

Sample Apps

We have built different sample apps and embedded them in the CLI, you can setup a sample project in your terminal by running

$ sample sample-react "~/Desktop/Work"

By default, all commands are run in test mode, to switch to live, append the flag "--domain live" at the end of your command

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @paystack-oss/dev-cli

Weekly Downloads

222

Version

1.0.0-nightly.0

License

MIT

Unpacked Size

158 kB

Total Files

38

Last publish

Collaborators

  • pstk-infra
  • luqman008