@qpay-sdk/cli
v1.0.0
Published
CLI tool for QPay V2 Payment API — create invoices, check payments, test webhooks
Maintainers
Readme
qpay-cli
CLI tool for the QPay V2 Payment API. Create invoices, check payments, and test webhooks from the terminal.
Installation
npm install -g qpay-cliOr use directly with npx:
npx qpay-cli helpSetup
Configure your QPay merchant credentials:
qpay setupThis saves credentials to ~/.qpay/config.json. Alternatively, set environment variables:
export QPAY_BASE_URL=https://merchant.qpay.mn
export QPAY_USERNAME=your_username
export QPAY_PASSWORD=your_password
export QPAY_INVOICE_CODE=your_invoice_code
export QPAY_CALLBACK_URL=https://yoursite.com/webhookUsage
Create Invoice
qpay invoice create --amount 5000 --order ORD-001
qpay invoice create -a 10000 -o ORD-002 --description "Product payment"
qpay invoice create --amount 5000 --jsonCheck Payment
qpay payment check INVOICE_ID
qpay payment check INVOICE_ID --jsonCancel Invoice
qpay invoice cancel INVOICE_IDWebhook Listener
Start a local webhook listener for testing:
qpay webhook listen
qpay webhook listen 8080This starts a local HTTP server that:
- Receives QPay webhook callbacks
- Automatically verifies payments via the QPay API
- Logs events to the console with color-coded status
- Provides a web dashboard at
http://localhost:4040 - Returns event history at
GET /events
Configuration
qpay config # Show current configuration
qpay setup # Interactive setup wizardSandbox
Use --sandbox flag to target the sandbox environment:
qpay invoice create --amount 100 --sandboxCommands
| Command | Description |
|---------|-------------|
| qpay setup | Interactive credential setup |
| qpay invoice create | Create a new invoice |
| qpay invoice get <id> | Get invoice details |
| qpay invoice cancel <id> | Cancel an invoice |
| qpay payment check <id> | Check payment status |
| qpay webhook listen [port] | Start webhook listener (default: 4040) |
| qpay config | Show current configuration |
| qpay help | Show help |
| qpay version | Show version |
Links
- QPay SDK Documentation
- QPay SDK GitHub
- qpay-js (base SDK)
License
MIT
