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.
Current Status: v1.1.0 - Production ReadyCore authentication, merchant management, API keys, and payment intents with hosted checkout are fully functional.
Generates default config file with production URLs
Sets up environment profiles (development, production)
Defaults to production environment
2
Verify Configuration
payment-cli config show
Output:
📋 Current Configuration═══════════════════════════════════════🌍 Environment Settings: Current Environment: production API URL: https://paymentgateway.redahaloubi.com Auth URL: https://paymentgateway.redahaloubi.com Payment URL: https://paymentgateway.redahaloubi.com🔐 Credentials: Access Token: Not set User Email: Not logged in Merchant ID: Not set API Key: Not set⚙️ Preferences: Output Format: table Color Enabled: true Debug Mode: false📁 Config File: /Users/john/.payment-cli/config.yaml
Email: [email protected]Full Name: John MerchantPassword: ********Confirm Password: ********
Output:
✅ Account created successfully!📧 Email: [email protected]👤 Name: John Merchant🆔 User ID: 550e8400-e29b-41d4-a716-446655440000🚀 Next step: payment-cli auth login
Business Name: Your Store IncLegal Name: Your Store Incorporatedall the business types: individual sole_proprietor partnership corporation non_profitchoose one of themBusiness Type: corporation
Output:
✅ Merchant created!🆔 ID: merchant_abc123def456📧 Email: [email protected]🏪 Business Name: Your Store Inc🏢 Business Type: corporation🔑 Status: pending👤 Owner ID: 550e8400-e29b-41d4-a716-446655440000💡 Next: payment-cli apikey create
Non-Interactive:
payment-cli merchant create \ --business-name "Your Store Inc" \ --legal-name "Your Store Incorporated" \ --email "[email protected]"
View merchant details:
payment-cli merchant get
Output:
🏪 ID: merchant_abc123def456📧 Email: [email protected]🏪 Business Name: Your Store Inc👤 Legal Name: Your Store Incorporated🏢 Business Type: corporation🔑 Status: active🌍 Country Code: US💵 Currency Code: USD👤 Owner ID: 550e8400-e29b-41d4-a716-446655440000🔑 Merchant Code: mch_xyz789abc123
✅ API key created!🔑 API Key: Production Server KeyPlease copy the plain key, it will not be shown again🔑 Plain Key: pk_live_abc123def456ghi789jkl012mno345pqr678
IMPORTANT: Save this key immediately! It cannot be retrieved again.
Store API key locally for CLI usage:
payment-cli apikey store pk_live_abc123def456ghi789jkl012mno345pqr678
Output:
✅ API key stored!
The key is now saved in your config file and will be used automatically for payment operations.
🔑 Role ID: role_abc123👤 Role: owner📝 Description: Full access to merchant account🔑 Role ID: role_def456👤 Role: admin📝 Description: Administrative access🔑 Role ID: role_ghi789👤 Role: developer📝 Description: API access only
Payment Intents provide a hosted checkout page where customers can securely enter their payment details. The CLI opens the checkout in your browser and polls for completion.
Create Intent
With Flags
Create a payment intent with hosted checkout:
payment-cli payment intent create
Interactive prompts:
💳 Create Payment Intent═══════════════════════════════════════Amount (in cents): 5000Currency:▸ USD EUR MADDescription (optional, press enter to skip): Premium Plan SubscriptionCustomer Email (optional, press enter to skip): [email protected]Capture Method:▸ automatic manual
Output:
✅ Payment intent created!📋 Payment Intent Details: ID: pi_abc123def456ghi789 Amount: 5000 USD ($50.00 USD) Status: created Description: Premium Plan Subscription Expires: 2026-01-26 15:30:00🌐 Checkout URL: https://checkout-page-amber.vercel.app/checkout/pi_abc123def456?client_secret=...🚀 Opening checkout page in your browser...💡 Complete the payment in your browser⏳ Waiting for payment completion... (Press Ctrl+C to cancel polling)
# Work on productionpayment-cli config use productionpayment-cli merchant create# Switch to local devpayment-cli config use developmentpayment-cli payment intent create# Back to productionpayment-cli config use production
Cause: Binary not in PATHSolutions:Option 1: Move to PATH
sudo mv payment-cli /usr/local/bin/
Option 2: Run from current directory
./payment-cli --help
Option 3: Add to PATH
export PATH=$PATH:$(pwd)
'config file not found'
Cause: CLI not initializedSolution:
payment-cli init
Verify:
ls -la ~/.payment-cli/# Should show config.yaml
'connection refused' errors
Cause: Wrong environment or API server not reachableSolutions:Check environment:
payment-cli config show# Verify API URL is correct
Switch to production:
payment-cli config use production
Test connectivity:
payment-cli health
'unauthorized' errors
Cause: Not logged in or token expiredSolution:
# Check login statuspayment-cli whoami# Login if neededpayment-cli auth login
'API key not set'
Cause: No API key stored in configSolution:
# Create API keypayment-cli apikey create# Store the keypayment-cli apikey store pk_live_your_key_here# Verifypayment-cli config show
Browser doesn't open for payment intents
Cause: Platform not supported or browser not availableSolution: The checkout URL is displayed in the terminal. Copy and paste it into your browser manually. The CLI will still poll for payment completion.
Payment intent polling timeout
Cause: Payment took longer than 15 minutesSolution: Check your merchant dashboard for payment status, or create a new payment intent.
#!/bin/bash# Automated merchant setup scriptecho "🚀 Setting up new merchant..."# Loginpayment-cli auth login --email $ADMIN_EMAIL --password $ADMIN_PASSWORD# Create merchantecho "Creating merchant..."payment-cli merchant create \ --business-name "New Store" \ --legal-name "New Store LLC" \ --email "[email protected]"# Create API keyecho "Generating API key..."payment-cli apikey createecho "✅ Setup complete!"echo "💡 Don't forget to store your API key:"echo "payment-cli apikey store <your_key>"
Initialize CLI configurationUsage:payment-cli initCreates config directory and default settings file.
payment-cli auth register
Register new user accountUsage:payment-cli auth register [--email EMAIL] [--name NAME] [--password PASSWORD]Interactive: If flags omitted, prompts for input
payment-cli auth login
Authenticate userUsage:payment-cli auth login [--email EMAIL] [--password PASSWORD]Interactive: If flags omitted, prompts for input
payment-cli auth logout
Revoke current sessionUsage:payment-cli auth logout
payment-cli whoami
Show current user infoUsage:payment-cli whoami
payment-cli auth profile
Show detailed user profileUsage:payment-cli auth profile
payment-cli auth change-password
Change user passwordUsage:payment-cli auth change-password [--old-password OLD] [--new-password NEW]
payment-cli merchant create
Create new merchantUsage:payment-cli merchant create [FLAGS]Flags:
--business-name: Business name
--legal-name: Legal name
--email: Business email
payment-cli merchant get
Get merchant detailsUsage:payment-cli merchant get