Payment Gateway CLI
A powerful command-line interface for interacting with the Payment Gateway API. Perfect for testing, automation, and quick merchant operations without building a full integration.Why Use the CLI?
Rapid Testing
Hosted Checkout
Developer Friendly
Multi-Environment
Installation
Prerequisites
- Requirements
- Optional Tools
Method 1: Install Pre-Built Binary (Recommended)
Download Latest Release
Make Executable (Linux/macOS)
Move to PATH
payment-cli.exe to a directory in your PATH, or add its location to PATH.Verify Installation
Method 2: Build from Source
Clone Repository
Install Dependencies
cobra- CLI frameworkcolor- Colored terminal outputtablewriter- Table formattingspinner- Loading animationspromptui- Interactive promptsyaml.v3- Config file handling
Build Binary
Install Globally (Optional)
Quick Start
Initialize CLI
Run Init Command
- Creates config directory:
~/.payment-cli/ - Generates default config file with production URLs
- Sets up environment profiles (development, production)
- Defaults to production environment
Verify Configuration
Register and Login
Core Commands
Authentication
- Register
- Login
- Whoami
- Profile
- Change Password
- Logout
Merchant Management
- Create Merchant
- Get Merchant
- Access Accounts
- Team Members
- Invite User
- List Invitations
- Settings
API Key Management
- Create API Key
- Store API Key
Roles Management
- View Roles
Configuration Management
- Show Config
- Set Preference
- Switch Environment
- Reset Config
Payment Operations
Payment Intents (Hosted Checkout)
- Create Intent
- With Flags
- CLI creates payment intent via API
- Browser opens automatically with checkout URL
- Customer enters payment details on hosted page
- CLI polls payment status every 3 seconds
- Shows success/failure when payment completes
- Times out after 15 minutes if no completion
Direct Payment Authorization
Transaction Management
- List Transactions
- Capture
- Void
- Refund
Advanced Features
Health Check
Verify API connectivity:Debug Mode
Enable verbose logging for troubleshooting:Output Formats
- Table (Default)
- JSON
- YAML
Example Workflows
Workflow 1: Complete Setup
From zero to payment-ready in 3 minutes:Workflow 2: Testing Payment Flow
Test a complete payment with hosted checkout:Workflow 3: Environment Switching
Switch between development and production:Configuration File
The CLI stores configuration in~/.payment-cli/config.yaml:
Troubleshooting
'payment-cli: command not found'
'payment-cli: command not found'
'config file not found'
'config file not found'
'connection refused' errors
'connection refused' errors
'API key not set'
'API key not set'
Browser doesn't open for payment intents
Browser doesn't open for payment intents
Payment intent polling timeout
Payment intent polling timeout
Scripting & Automation
Bash Script Example
CI/CD Integration
Command Reference
Complete Command List
payment-cli init
payment-cli init
payment-cli initCreates config directory and default settings file.payment-cli auth register
payment-cli auth register
payment-cli auth register [--email EMAIL] [--name NAME] [--password PASSWORD]Interactive: If flags omitted, prompts for inputpayment-cli auth login
payment-cli auth login
payment-cli auth login [--email EMAIL] [--password PASSWORD]Interactive: If flags omitted, prompts for inputpayment-cli auth logout
payment-cli auth logout
payment-cli auth logoutpayment-cli whoami
payment-cli whoami
payment-cli whoamipayment-cli auth profile
payment-cli auth profile
payment-cli auth profilepayment-cli auth change-password
payment-cli auth change-password
payment-cli auth change-password [--old-password OLD] [--new-password NEW]payment-cli merchant create
payment-cli merchant create
payment-cli merchant create [FLAGS]Flags:--business-name: Business name--legal-name: Legal name--email: Business email
payment-cli merchant get
payment-cli merchant get
payment-cli merchant getpayment-cli merchant access-accounts
payment-cli merchant access-accounts
payment-cli merchant access-accounts [--merchant-id ID]payment-cli merchant team
payment-cli merchant team
payment-cli merchant teampayment-cli merchant invite
payment-cli merchant invite
payment-cli merchant invitepayment-cli merchant invitations
payment-cli merchant invitations
payment-cli merchant invitationspayment-cli merchant setting
payment-cli merchant setting
payment-cli merchant settingpayment-cli apikey create
payment-cli apikey create
payment-cli apikey createpayment-cli apikey store
payment-cli apikey store
payment-cli apikey store <plain_key>payment-cli roles view
payment-cli roles view
payment-cli roles viewpayment-cli payment intent create
payment-cli payment intent create
payment-cli payment intent create [FLAGS]Flags:--amount, -a: Amount in cents--currency, -c: Currency (USD, EUR, MAD)--email, -e: Customer email--description, -d: Payment description--capture: Capture method (automatic/manual)--order-id: Your internal order ID
payment-cli payment transactions
payment-cli payment transactions
payment-cli payment transactionspayment-cli payment capture
payment-cli payment capture
payment-cli payment capturepayment-cli payment void
payment-cli payment void
payment-cli payment voidpayment-cli payment refund
payment-cli payment refund
payment-cli payment refundpayment-cli config show
payment-cli config show
payment-cli config showpayment-cli config set
payment-cli config set
payment-cli config set <key> <value>Keys: output_format, color_enabled, debug_modepayment-cli config use
payment-cli config use
payment-cli config use <environment>Environments: production, developmentpayment-cli config reset
payment-cli config reset
payment-cli config resetpayment-cli health
payment-cli health
payment-cli healthGlobal Flags
Tips & Best Practices
Production by Default
Production by Default
Secure Your API Keys
Secure Your API Keys
Use Environment Variables
Use Environment Variables
Test Payment Intents
Test Payment Intents
- Success: 4242 4242 4242 4242
- Decline: 4000 0000 0000 0002
- Expired: 4000 0000 0000 0069
Monitor Payment Status
Monitor Payment Status
Whatβs New in v1.1.0
Payment Intents
Enhanced Config
Better UX
More Commands
Support
Need help? Weβre here for you:- Documentation: docs-paymentgateway.redahaloubi.com
- Email: [email protected]
- Issues: GitHub Issues
License
MIT License - See LICENSE file for details.**Built with β€οΈ for **Reda haloubi