Skip to content

CLI tool for QPay V2 Payment API — create invoices, check payments, test webhooks

License

Notifications You must be signed in to change notification settings

qpay-sdk/qpay-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qpay-cli

License: MIT npm

CLI tool for the QPay V2 Payment API. Create invoices, check payments, and test webhooks from the terminal.

Installation

npm install -g qpay-cli

Or use directly with npx:

npx qpay-cli help

Setup

Configure your QPay merchant credentials:

qpay setup

This 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/webhook

Usage

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 --json

Check Payment

qpay payment check INVOICE_ID
qpay payment check INVOICE_ID --json

Cancel Invoice

qpay invoice cancel INVOICE_ID

Webhook Listener

Start a local webhook listener for testing:

qpay webhook listen
qpay webhook listen 8080

This 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 wizard

Sandbox

Use --sandbox flag to target the sandbox environment:

qpay invoice create --amount 100 --sandbox

Commands

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

License

MIT

About

CLI tool for QPay V2 Payment API — create invoices, check payments, test webhooks

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors