QPay V2 API cURL examples. Ready-to-use shell scripts for authentication, invoice creation, payment operations, and ebarimt (electronic tax receipt) support.
- Clone the repository:
git clone https://github.com/qpay-sdk/qpay-curl.git
cd qpay-curl- Create a
.envfile with your credentials:
QPAY_BASE_URL=https://merchant.qpay.mn
QPAY_USERNAME=your_username
QPAY_PASSWORD=your_password
QPAY_INVOICE_CODE=your_invoice_code
QPAY_CALLBACK_URL=https://example.com/callback- Authenticate:
source helpers/auth.shThis exports ACCESS_TOKEN and REFRESH_TOKEN to your shell session.
# Get access token (Basic Auth)
./examples/auth/get-token.sh
# Refresh token
source helpers/auth.sh # sets REFRESH_TOKEN
./examples/auth/refresh-token.sh# Create a simple invoice (minimal fields)
source helpers/auth.sh
./examples/invoice/create-simple.sh
# Create a full invoice (all options, line items, transactions)
./examples/invoice/create-invoice.sh
# Cancel an invoice
INVOICE_ID="your_invoice_id" ./examples/invoice/cancel-invoice.sh# Check payment status for an invoice
INVOICE_ID="your_invoice_id" ./examples/payment/check-payment.sh
# Get payment details
PAYMENT_ID="your_payment_id" ./examples/payment/get-payment.sh
# List payments with date range
./examples/payment/list-payments.sh
# Cancel a payment (card only)
PAYMENT_ID="your_payment_id" ./examples/payment/cancel-payment.sh
# Refund a payment (card only)
PAYMENT_ID="your_payment_id" ./examples/payment/refund-payment.sh# Create ebarimt for a payment
PAYMENT_ID="your_payment_id" ./examples/ebarimt/create-ebarimt.sh
# Cancel ebarimt
PAYMENT_ID="your_payment_id" ./examples/ebarimt/cancel-ebarimt.shqpay-curl/
├── .env.example
├── helpers/
│ └── auth.sh # Auth helper (exports ACCESS_TOKEN)
└── examples/
├── auth/
│ ├── get-token.sh # POST /v2/auth/token
│ └── refresh-token.sh # POST /v2/auth/refresh
├── invoice/
│ ├── create-simple.sh # POST /v2/invoice (minimal)
│ ├── create-invoice.sh # POST /v2/invoice (full)
│ └── cancel-invoice.sh # DELETE /v2/invoice/{id}
├── payment/
│ ├── check-payment.sh # POST /v2/payment/check
│ ├── get-payment.sh # GET /v2/payment/{id}
│ ├── list-payments.sh # POST /v2/payment/list
│ ├── cancel-payment.sh # DELETE /v2/payment/cancel/{id}
│ └── refund-payment.sh # DELETE /v2/payment/refund/{id}
└── ebarimt/
├── create-ebarimt.sh # POST /v2/ebarimt_v3/create
└── cancel-ebarimt.sh # DELETE /v2/ebarimt_v3/{id}
| Method | Endpoint | Script |
|---|---|---|
POST |
/v2/auth/token |
auth/get-token.sh |
POST |
/v2/auth/refresh |
auth/refresh-token.sh |
POST |
/v2/invoice |
invoice/create-simple.sh, invoice/create-invoice.sh |
DELETE |
/v2/invoice/{id} |
invoice/cancel-invoice.sh |
POST |
/v2/payment/check |
payment/check-payment.sh |
GET |
/v2/payment/{id} |
payment/get-payment.sh |
POST |
/v2/payment/list |
payment/list-payments.sh |
DELETE |
/v2/payment/cancel/{id} |
payment/cancel-payment.sh |
DELETE |
/v2/payment/refund/{id} |
payment/refund-payment.sh |
POST |
/v2/ebarimt_v3/create |
ebarimt/create-ebarimt.sh |
DELETE |
/v2/ebarimt_v3/{id} |
ebarimt/cancel-ebarimt.sh |
MIT