CLI tool for the QPay V2 Payment API. Create invoices, check payments, and test webhooks from the terminal.
npm install -g qpay-cliOr use directly with npx:
npx qpay-cli helpConfigure 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/webhookqpay invoice create --amount 5000 --order ORD-001
qpay invoice create -a 10000 -o ORD-002 --description "Product payment"
qpay invoice create --amount 5000 --jsonqpay payment check INVOICE_ID
qpay payment check INVOICE_ID --jsonqpay invoice cancel INVOICE_IDStart 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
qpay config # Show current configuration
qpay setup # Interactive setup wizardUse --sandbox flag to target the sandbox environment:
qpay invoice create --amount 100 --sandbox| 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 |
- QPay SDK Documentation
- QPay SDK GitHub
- qpay-js (base SDK)
MIT