The Paystack CLI helps you build, test, and manage your Paystack integration right from the terminal. Interact with the Paystack API, test webhooks locally, and manage your integration settings without leaving your command line.
- Features
- Installation
- Quick Start
- Authentication
- Commands
- Configuration
- Webhook Testing
- API Resources
- Examples
- Development
- Troubleshooting
- Contributing
- License
Complete Paystack API Access - Access all Paystack API endpoints directly from your terminal
Secure Authentication - Login once and securely manage your Paystack integration
Local Webhook Testing - Test webhooks locally using ngrok integration
Configuration Management - Configure API settings, timeouts, and debug modes
Beautiful Output - Formatted JSON responses with colored output for better readability
Developer Friendly - Built with TypeScript for type safety and better DX
npm install -g @toneflix/paystack-clipnpm add -g @toneflix/paystack-cliyarn global add @toneflix/paystack-cliAfter installation, verify the CLI is installed correctly:
paystack-cli --version-
Initialize the CLI
paystack-cli init
-
Login to your Paystack account
paystack-cli login
-
Start using Paystack API commands
# List all transactions paystack-cli transaction:list # Fetch customer details paystack-cli customer:fetch --id=CUS_xxxxx # Create a new plan paystack-cli plan:create --name="Monthly Plan" --amount=5000 --interval=monthly
The CLI uses your Paystack account credentials for authentication:
paystack-cli loginYou'll be prompted for:
- Email: Your Paystack account email
- Password: Your Paystack account password
- Remember: Option to save your email for future logins
After successful login, you'll select which integration to use (if you have multiple).
To logout and clear your session:
paystack-cli logout- Sessions automatically expire after the token timeout period
- You'll be prompted to login again when your session expires
- Login credentials are securely stored in a local SQLite database
Initialize the Paystack CLI application and setup the local database.
paystack-cli initAuthenticate with your Paystack account.
paystack-cli loginOptions:
- Interactive prompts for email and password
- Option to remember email for faster login
- Automatic integration selection for accounts with multiple integrations
Sign out and clear your authentication session.
paystack-cli logoutConfigure CLI settings like API base URL, timeout duration, and debug mode.
paystack-cli configAvailable configurations:
- API Base URL: Default Paystack API endpoint
- Timeout Duration: Request timeout in milliseconds
- Debug Mode: Enable/disable detailed error logging
- Ngrok Auth Token: Set ngrok authentication token for webhook testing
Start a local webhook listener using ngrok tunneling.
paystack-cli webhook listen [local_route]Arguments:
local_route(optional): Your local webhook endpoint (e.g.,http://localhost:8080/webhook)
Options:
--domain, -D: Specify domain to ping (test/live)[default: test]--forward, -F: Forward webhook to a specific URL
Example:
# Listen on default route
paystack-cli webhook listen
# Listen on specific route
paystack-cli webhook listen http://localhost:3000/api/webhook
# Listen with custom domain
paystack-cli webhook listen http://localhost:8080 --domain=liveSend a test webhook event to your configured webhook URL.
paystack-cli webhook pingOptions:
--event, -E: Event type to simulate (charge.success, transfer.success, etc.)--domain, -D: Domain to ping (test/live)[default: test]--forward, -F: Forward to specific URL instead of saved webhook
Example:
# Test charge success event
paystack-cli webhook ping --event=charge.success
# Test transfer failed on live
paystack-cli webhook ping --event=transfer.failed --domain=liveAll Paystack API endpoints are available as commands. The general format is:
paystack-cli [resource]:[action] [options]The CLI provides access to the following Paystack resources:
Manage payment transactions.
# Initialize a transaction
paystack-cli transaction:initialize --email=customer@email.com --amount=10000
# List all transactions
paystack-cli transaction:list --perPage=50 --page=1
# Verify a transaction
paystack-cli transaction:verify --reference=xyz123
# View transaction details
paystack-cli transaction:view --id=123456
# Charge authorization
paystack-cli transaction:charge --authorization_code=AUTH_xxx --email=user@example.com --amount=5000
# Export transactions
paystack-cli transaction:export --from=2024-01-01 --to=2024-12-31
# Check authorization
paystack-cli transaction:check --authorization_code=AUTH_xxx --email=user@example.com --amount=5000
# Get transaction totals
paystack-cli transaction:transaction --from=2024-01-01 --to=2024-12-31
# Fetch transaction
paystack-cli transaction:fetch --id=12345Manage customer information.
# Create customer
paystack-cli customer:create --email=user@example.com --first_name=John --last_name=Doe
# Update customer
paystack-cli customer:update --code=CUS_xxx --first_name=Jane
# Fetch customer
paystack-cli customer:fetch --code=CUS_xxx
# List customers
paystack-cli customer:list --perPage=20 --page=1
# Set risk action
paystack-cli customer:set_risk_action --customer=CUS_xxx --risk_action=allow
# Deactivate authorization
paystack-cli customer:deactivate --authorization_code=AUTH_xxxCreate and manage subscription plans.
# Create plan
paystack-cli plan:create --name="Premium Plan" --amount=50000 --interval=monthly
# Update plan
paystack-cli plan:update --code=PLN_xxx --amount=60000
# List plans
paystack-cli plan:list --interval=monthly --amount=50000
# Fetch plan
paystack-cli plan:fetch --code=PLN_xxxManage customer subscriptions.
# Create subscription
paystack-cli subscription:create --customer=CUS_xxx --plan=PLN_xxx
# Disable subscription
paystack-cli subscription:disable --code=SUB_xxx --token=email_token
# Enable subscription
paystack-cli subscription:enable --code=SUB_xxx --token=email_token
# Fetch subscription
paystack-cli subscription:fetch --code=SUB_xxx
# List subscriptions
paystack-cli subscription:list --customer=CUS_xxx --plan=PLN_xxxHandle money transfers.
# Initiate transfer
paystack-cli transfer:initiate --source=balance --amount=10000 --recipient=RCP_xxx
# List transfers
paystack-cli transfer:list --perPage=50
# Verify transfer
paystack-cli transfer:verify --reference=TRF_xxx
# Finalize transfer
paystack-cli transfer:finalize --transfer_code=TRF_xxx --otp=123456
# Bulk transfer
paystack-cli transfer:initiate --transfers='[{"amount":10000,"recipient":"RCP_xxx"}]'
# Disable OTP
paystack-cli transfer:disable
# Enable OTP
paystack-cli transfer:enable
# Resend OTP
paystack-cli transfer:resend --transfer_code=TRF_xxx --reason=resend_otp
# Fetch transfer
paystack-cli transfer:fetch --code=TRF_xxxManage transfer recipients.
# Create recipient
paystack-cli transferrecipient:create --type=nuban --name="John Doe" --account_number=0123456789 --bank_code=033
# Update recipient
paystack-cli transferrecipient:update --code=RCP_xxx --name="Jane Doe"
# Delete recipient
paystack-cli transferrecipient:delete --code=RCP_xxx
# List recipients
paystack-cli transferrecipient:list --perPage=50Manage split payment subaccounts.
# Create subaccount
paystack-cli subaccount:create --business_name="Vendor Co" --settlement_bank=033 --account_number=0123456789 --percentage_charge=10
# Update subaccount
paystack-cli subaccount:update --code=ACCT_xxx --business_name="New Name"
# Fetch subaccount
paystack-cli subaccount:fetch --code=ACCT_xxx
# List subaccounts
paystack-cli subaccount:listCreate and manage payment pages.
# Create page
paystack-cli page:create --name="Donation Page" --amount=5000
# Update page
paystack-cli page:update --code=PAGE_xxx --name="New Page Name"
# Fetch page
paystack-cli page:fetch --code=PAGE_xxx
# List pages
paystack-cli page:list
# Check slug availability
paystack-cli page:check --slug=my-pageManage payment requests and invoices.
# Create payment request
paystack-cli paymentrequest:create --customer=CUS_xxx --amount=10000 --description="Invoice for services"
# List payment requests
paystack-cli paymentrequest:list
# Fetch payment request
paystack-cli paymentrequest:fetch --code=PRQ_xxx
# Update payment request
paystack-cli paymentrequest:update --code=PRQ_xxx --amount=15000
# Verify payment request
paystack-cli paymentrequest:verify --code=PRQ_xxx
# Send notification
paystack-cli paymentrequest:send --code=PRQ_xxx
# Finalize payment request
paystack-cli paymentrequest:finalize --code=PRQ_xxx
# View invoice
paystack-cli paymentrequest:invoice --code=PRQ_xxxHandle card charges and tokenization.
# Submit OTP
paystack-cli charge:submit --otp=123456 --reference=ref_xxx
# Submit PIN
paystack-cli charge:submit --pin=1234 --reference=ref_xxx
# Submit birthday
paystack-cli charge:submit --birthday=1990-01-01 --reference=ref_xxx
# Submit phone
paystack-cli charge:submit --phone=08012345678 --reference=ref_xxx
# Tokenize charge
paystack-cli charge:tokenize --card=xxx
# Check pending charge
paystack-cli charge:check --reference=ref_xxx
# Charge
paystack-cli charge:charge --email=user@example.com --amount=10000Manage bulk charge operations.
# Initiate bulk charge
paystack-cli bulkcharge:initiate --charges='[{"authorization":"AUTH_xxx","amount":10000}]'
# Fetch bulk charge
paystack-cli bulkcharge:fetch --code=BCH_xxx
# Fetch bulk charge charges
paystack-cli bulkcharge:fetch --code=BCH_xxx
# Pause bulk charge
paystack-cli bulkcharge:pause --code=BCH_xxx
# Resume bulk charge
paystack-cli bulkcharge:resume --code=BCH_xxxProcess refunds for transactions.
# Create refund
paystack-cli refund:create --transaction=TRX_xxx --amount=5000
# List refunds
paystack-cli refund:list --transaction=TRX_xxx
# Fetch refund
paystack-cli refund:fetch --code=RFD_xxxGet bank information.
# List banks
paystack-cli bank:list --country=nigeria --use_cursor=true
# Resolve account number
paystack-cli bank:resolve --account_number=0123456789 --bank_code=033
# Resolve BVN
paystack-cli bank:resolve --bvn=12345678901
# Match BVN with account
paystack-cli bank:match --account_number=0123456789 --bank_code=033 --bvn=12345678901View settlement information.
# Fetch settlements
paystack-cli settlement:fetch --from=2024-01-01 --to=2024-12-31 --subaccount=ACCT_xxxManage integration settings.
# Fetch payment session timeout
paystack-cli integration:fetch
# Update payment session timeout
paystack-cli integration:update --timeout=600Check account balance.
# Check balance
paystack-cli balance:check
# View balance ledger
paystack-cli balance:balanceVerify customer information.
# Resolve verification
paystack-cli verifications:resolve --verification_type=truecaller --phone=08012345678Card information lookup.
# Resolve card BIN
paystack-cli decision:resolve --bin=123456Manage invoices.
# Archive invoice
paystack-cli invoice:archive --code=INV_xxxThe CLI stores configuration in a local database. Use the config command to modify settings:
paystack-cli config-
API Base URL
- Default:
https://api.paystack.co - Change this to use a different Paystack API endpoint
- Default:
-
Timeout Duration
- Default:
3000ms - HTTP request timeout in milliseconds
- Default:
-
Debug Mode
- Default:
false - Enable to see detailed error messages and stack traces
- Default:
-
Ngrok Auth Token
- Required for webhook testing
- Get your token from ngrok.com
You can also set configuration via environment variables:
NGROK_AUTH_TOKEN: Your ngrok authentication tokenNGROK_DOMAIN: Custom ngrok domain (if you have a paid plan)
-
Configure ngrok token (first time only):
paystack-cli config # Select "Ngrok Auth Token" and enter your token -
Start webhook listener:
paystack-cli webhook listen http://localhost:3000/webhook
The CLI will:
- Create an ngrok tunnel to your local server
- Update your Paystack webhook URL automatically
- Forward all webhook events to your local endpoint
Send test webhook events:
# Test successful charge
paystack-cli webhook ping --event=charge.success
# Test transfer events
paystack-cli webhook ping --event=transfer.success
paystack-cli webhook ping --event=transfer.failed
# Test subscription event
paystack-cli webhook ping --event=subscription.createcharge.success- Successful paymenttransfer.success- Successful transfertransfer.failed- Failed transfersubscription.create- New subscription created
# 1. Initialize transaction
paystack-cli transaction:initialize \
--email=customer@example.com \
--amount=50000 \
--reference=ORDER_12345
# 2. After customer pays, verify transaction
paystack-cli transaction:verify --reference=ORDER_12345
# 3. View transaction details
paystack-cli transaction:view --id=123456# 1. Create a plan
paystack-cli plan:create \
--name="Monthly Premium" \
--amount=50000 \
--interval=monthly
# 2. Create customer
paystack-cli customer:create \
--email=subscriber@example.com \
--first_name=John \
--last_name=Doe
# 3. Create subscription
paystack-cli subscription:create \
--customer=CUS_xxx \
--plan=PLN_xxx# 1. Create transfer recipient
paystack-cli transferrecipient:create \
--type=nuban \
--name="Jane Doe" \
--account_number=0123456789 \
--bank_code=033
# 2. Initiate transfer
paystack-cli transfer:initiate \
--source=balance \
--amount=50000 \
--recipient=RCP_xxx \
--reason="Payment for services"
# 3. If OTP is required, finalize with OTP
paystack-cli transfer:finalize \
--transfer_code=TRF_xxx \
--otp=123456- Node.js >= 18
- PNPM (recommended) or NPM
# Clone repository
git clone https://github.com/toneflix/paystack-cli.git
cd paystack-cli
# Install dependencies
pnpm install
# Run in development mode
pnpm runner [command]
# Build
pnpm build
# Run tests
pnpm testpaystack-cli/
├── src/
│ ├── Commands/ # CLI command classes
│ │ ├── Commands.ts # Dynamic API command generator
│ │ ├── InitCommand.ts
│ │ ├── LoginCommand.ts
│ │ ├── LogoutCommand.ts
│ │ ├── ConfigCommand.ts
│ │ └── WebhookCommand.ts
│ ├── Contracts/ # TypeScript interfaces
│ ├── paystack/ # Paystack API definitions
│ │ ├── apis.ts # All API endpoint schemas
│ │ └── webhooks.ts # Webhook event handlers
│ ├── utils/ # Utility functions
│ ├── cli.ts # Application entry point
│ ├── db.ts # Local database management
│ ├── helpers.ts # Helper functions
│ ├── hooks.ts # Custom hooks
│ └── Paystack.ts # Paystack API client
├── bin/ # Executable files
├── tests/ # Test files
└── package.json- Framework: H3ravel Musket - CLI framework
- Language: TypeScript
- Database: SQLite (via better-sqlite3)
- HTTP Client: Axios
- Tunneling: ngrok
- Build Tool: tsdown
1. "You're not signed in" error
# Solution: Login first
paystack-cli login2. "Session expired" error
# Solution: Login again
paystack-cli logout
paystack-cli login3. Webhook listener not working
# Solution: Check ngrok token is configured
paystack-cli config
# Select "Ngrok Auth Token" and enter your token from ngrok.com4. Command not found
# Solution: Ensure CLI is installed globally
npm install -g @toneflix/paystack-cli
# Or reinstall
npm uninstall -g @toneflix/paystack-cli
npm install -g @toneflix/paystack-cli5. Permission errors on macOS/Linux
# Solution: Use sudo for global installation
sudo npm install -g @toneflix/paystack-cliEnable debug mode to see detailed error information:
paystack-cli config
# Select "Debug Mode" and choose "true"For any command, you can get help by running:
paystack-cli [command] --helpOr visit the Paystack API Documentation for API-specific information.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write TypeScript with proper type definitions
- Follow existing code style
- Add tests for new features
- Update documentation for API changes
- Ensure all tests pass before submitting PR
This project is licensed under the ISC License - see the LICENSE file for details.
- Email: support@toneflix.net
- Issues: GitHub Issues
- Docs: Paystack Documentation
- Community: Paystack Slack
- Built with H3ravel Musket
- Powered by Paystack
- Tunneling by ngrok
© Copyright 2026 - ToneFlix Technologies Limited