Download the PHP package usukhbayar/qpay-php without Composer

On this page you can find all versions of the php package usukhbayar/qpay-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package qpay-php

QPay PHP SDK

CI Packagist Version

PHP SDK for the QPay V2 payment gateway API. Provides a clean, type-safe interface with automatic token management, Guzzle-based HTTP, and comprehensive error handling.

Requirements

Installation

Quick Start

Configuration

Environment Variables

Variable Description
QPAY_BASE_URL QPay API base URL (e.g. https://merchant.qpay.mn)
QPAY_USERNAME Merchant username
QPAY_PASSWORD Merchant password
QPAY_INVOICE_CODE Default invoice code
QPAY_CALLBACK_URL Payment callback URL

Loading from Environment

Manual Configuration

Token Management

The SDK handles authentication automatically. When you make any API call, the client will:

  1. Obtain an access token if none exists
  2. Reuse the token while it is valid
  3. Refresh the token using the refresh token when expired
  4. Re-authenticate with credentials if the refresh token is also expired

You can also manage tokens manually:

Usage

Create Invoice (Full Options)

Create Simple Invoice

Create Invoice with Ebarimt (Tax)

Cancel Invoice

Get Payment Details

Check Payment Status

List Payments

Cancel Payment (Card Only)

Refund Payment (Card Only)

Create Ebarimt (Tax Receipt)

Cancel Ebarimt

Error Handling

All API errors throw QPay\Exceptions\QPayException:

Error Code Constants

The QPayException class provides constants for all known QPay error codes:

Available error code constants:

Constant Value
AUTHENTICATION_FAILED Authentication failed
PERMISSION_DENIED Permission denied
NO_CREDENDIALS Missing credentials
INVOICE_NOTFOUND Invoice not found
INVOICE_PAID Invoice already paid
INVOICE_ALREADY_CANCELED Invoice already cancelled
INVOICE_CODE_INVALID Invalid invoice code
INVOICE_LINE_REQUIRED Invoice lines required
PAYMENT_NOTFOUND Payment not found
PAYMENT_NOT_PAID Payment not paid
PAYMENT_ALREADY_CANCELED Payment already cancelled
INVALID_AMOUNT Invalid amount
MIN_AMOUNT_ERR Below minimum amount
MAX_AMOUNT_ERR Exceeds maximum amount
MERCHANT_NOTFOUND Merchant not found
MERCHANT_INACTIVE Merchant inactive
EBARIMT_NOT_REGISTERED Ebarimt not registered
EBARIMT_CANCEL_NOTSUPPERDED Ebarimt cancel not supported
CUSTOMER_NOTFOUND Customer not found
CUSTOMER_DUPLICATE Duplicate customer

See the QPayException class for the full list of constants.

API Reference

QPayClient Methods

Method Parameters Returns Description
getToken() - TokenResponse Authenticate and get token pair
refreshTokenRequest() - TokenResponse Refresh the access token
createInvoice() CreateInvoiceRequest InvoiceResponse Create invoice with full options
createSimpleInvoice() CreateSimpleInvoiceRequest InvoiceResponse Create invoice with minimal fields
createEbarimtInvoice() CreateEbarimtInvoiceRequest InvoiceResponse Create invoice with tax info
cancelInvoice() string $invoiceId void Cancel an invoice
getPayment() string $paymentId PaymentDetail Get payment details
checkPayment() PaymentCheckRequest PaymentCheckResponse Check payment status
listPayments() PaymentListRequest PaymentListResponse List payments
cancelPayment() string $paymentId, PaymentCancelRequest void Cancel a card payment
refundPayment() string $paymentId, PaymentRefundRequest void Refund a card payment
createEbarimt() CreateEbarimtRequest EbarimtResponse Create tax receipt
cancelEbarimt() string $paymentId EbarimtResponse Cancel tax receipt

Custom HTTP Client

You can inject a custom Guzzle client (useful for testing, proxies, or custom middleware):

Testing

License

MIT License. See LICENSE for details.


All versions of qpay-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package usukhbayar/qpay-php contains the following files

Loading the files please wait ...