Skip to Content
API ReferenceOverview

API Reference

Complete reference for the QPay V2 API. All endpoints use JSON request and response bodies. Authentication is via Bearer token, obtained through Basic Auth credentials.

Base URLs

EnvironmentURL
Productionhttps://merchant.qpay.mn
Sandboxhttps://merchant-sandbox.qpay.mn

Use the sandbox URL for development and testing. All API behavior is identical between environments.

Authentication

All endpoints (except POST /v2/auth/token) require a Bearer token in the Authorization header:

Authorization: Bearer <access_token>

To obtain a token, send your merchant credentials via Basic Auth to the token endpoint. See Authentication for full details.

Content Type

All requests must include the Content-Type header:

Content-Type: application/json

Endpoints Overview

Authentication

MethodEndpointDescription
POST/v2/auth/tokenGet access token
POST/v2/auth/refreshRefresh access token

Invoices

MethodEndpointDescription
POST/v2/invoiceCreate invoice
GET/v2/invoice/{id}Get invoice
DELETE/v2/invoice/{id}Cancel invoice
POST/v2/invoice/listList invoices
POST/v2/invoice/checkCheck invoice payment status

Payments

MethodEndpointDescription
GET/v2/payment/{id}Get payment details
POST/v2/payment/checkCheck payment status
POST/v2/payment/listList payments
POST/v2/payment/cancel/{id}Cancel payment
POST/v2/payment/refund/{id}Refund payment

Ebarimt

MethodEndpointDescription
POST/v2/ebarimt_v3/createCreate ebarimt
DELETE/v2/ebarimt_v3/{id}Cancel ebarimt

HTTP Status Codes

Status CodeDescription
200Success — request processed successfully
400Bad Request — invalid parameters or malformed request body
401Unauthorized — missing, invalid, or expired token
403Forbidden — insufficient permissions for this operation
404Not Found — the requested resource does not exist
500Internal Server Error — an unexpected error occurred on the QPay server

Error Response Format

All error responses return a JSON body with the following structure:

{ "error_code": "ERROR_CODE_STRING", "message": "Human-readable error description" }
FieldTypeDescription
error_codestringMachine-readable error code for programmatic handling
messagestringHuman-readable description of the error

See Error Codes for a complete list of error codes and their meanings.

Rate Limits

The QPay API applies rate limiting per merchant account. If you exceed the rate limit, you will receive a 429 Too Many Requests response. Implement exponential backoff in your retry logic.

Quick Start

Here is a minimal example of the complete payment flow using cURL:

1. Get Access Token

curl -X POST https://merchant.qpay.mn/v2/auth/token \ -H "Authorization: Basic $(echo -n 'username:password' | base64)" \ -H "Content-Type: application/json"

2. Create Invoice

curl -X POST https://merchant.qpay.mn/v2/invoice \ -H "Authorization: Bearer <access_token>" \ -H "Content-Type: application/json" \ -d '{ "invoice_code": "YOUR_INVOICE_CODE", "sender_invoice_no": "ORDER-001", "invoice_receiver_code": "terminal", "invoice_description": "Payment for Order #001", "amount": 50000, "callback_url": "https://yoursite.com/callback" }'

3. Check Payment Status

curl -X POST https://merchant.qpay.mn/v2/payment/check \ -H "Authorization: Bearer <access_token>" \ -H "Content-Type: application/json" \ -d '{ "object_type": "INVOICE", "object_id": "<invoice_id>" }'

For language-specific examples, see our SDK documentation.

Last updated on