Skip to Content
SDKsOverview

SDKs

QPay provides official SDKs for 11 languages, plus a cURL reference collection. Each SDK is a standalone package with identical functionality, covering all QPay V2 API endpoints.

Common Features

Every SDK includes:

  • Automatic token management — Access tokens are obtained, cached, and refreshed transparently. You never need to call auth endpoints manually.
  • Type-safe models — Strongly typed request and response objects in every language.
  • Structured error handling — Dedicated error types with HTTP status codes, QPay error codes, messages, and raw response bodies.
  • Full API coverage — Invoices (create, simple, ebarimt, cancel), payments (get, check, list, cancel, refund), and ebarimt operations (create, cancel).
  • Environment variable support — Load configuration from QPAY_* environment variables with a single function call.
  • Custom HTTP client support — Bring your own HTTP client for timeouts, proxies, or testing.

Available SDKs

LanguagePackageRegistryInstall Command
Goqpay-gopkg.go.dev go get github.com/qpay-sdk/qpay-go
JavaScript / TypeScriptqpay-jsnpm npm install qpay-js
Pythonqpay-pyPyPI pip install qpay-py
PHPusukhbayar/qpay-phpPackagist composer require usukhbayar/qpay-php
Javaqpay-javaMaven Central Maven / Gradle
Rubyqpay-sdkRubyGems gem install qpay-sdk
.NET (C#)QPayNuGet dotnet add package QPay
Dart / Flutterqpaypub.dev dart pub add qpay
SwiftQPaySPM Swift Package Manager
Rustqpaycrates.io cargo add qpay
cURLqpay-curlGitHub Shell scripts (no install)

Environment Variables

All SDKs read the same set of environment variables:

VariableRequiredDescription
QPAY_BASE_URLYesQPay API base URL (e.g., https://merchant.qpay.mn)
QPAY_USERNAMEYesQPay merchant username
QPAY_PASSWORDYesQPay merchant password
QPAY_INVOICE_CODEYesDefault invoice code for your merchant
QPAY_CALLBACK_URLYesURL that QPay calls after a payment is completed

API Coverage

All SDKs implement every operation in the QPay V2 API:

OperationMethodEndpointDescription
Get TokenPOST/v2/auth/tokenAuthenticate with Basic Auth and get access/refresh tokens
Refresh TokenPOST/v2/auth/refreshRefresh an expired access token using the refresh token
Create InvoicePOST/v2/invoiceCreate a detailed invoice with all available options
Create Simple InvoicePOST/v2/invoiceCreate an invoice with minimal required fields
Create Ebarimt InvoicePOST/v2/invoiceCreate an invoice with tax (ebarimt) information
Cancel InvoiceDELETE/v2/invoice/{id}Cancel an existing unpaid invoice
Get PaymentGET/v2/payment/{id}Retrieve full payment details by payment ID
Check PaymentPOST/v2/payment/checkCheck if a payment has been made for an invoice
List PaymentsPOST/v2/payment/listList payments with date range and pagination
Cancel PaymentDELETE/v2/payment/cancel/{id}Cancel a card payment
Refund PaymentDELETE/v2/payment/refund/{id}Refund a card payment
Create EbarimtPOST/v2/ebarimt_v3/createCreate an electronic tax receipt for a payment
Cancel EbarimtDELETE/v2/ebarimt_v3/{id}Cancel an electronic tax receipt

Typical Integration Flow

  1. Create an invoice — Call createSimpleInvoice with an amount and description. You get back a QR image and bank app deep links.
  2. Display to the user — Show the QR code or open a bank app deep link on mobile.
  3. Poll for payment — Periodically call checkPayment with the invoice ID to see if payment has been received.
  4. Receive callback — QPay sends a POST request to your callback_url when payment completes.
  5. Issue ebarimt — Optionally call createEbarimt to generate an electronic tax receipt.

GitHub Organization

All SDK repositories are hosted under the qpay-sdk  GitHub organization.

Last updated on