Skip to content

QPay

Payment flow

The QPay payment flow contains the following steps:

  1. The merchant initiates a payment request with QPay as a payment method.
  2. bePaid submits a request to the payment method provider. The provider generates deep links to mobile banking and payment service applications.
  3. bePaid sends a response with the received links and logos to the merchant.
  4. The merchant builds a form with logos linking to mobile banking and payment service applications.
  5. The customer selects a suitable bank or payment service and completes the payment with the chosen banking application.
  6. After the payment is finalized, bePaid sends a webhook notification on the transaction details and status to the merchant.

This alternative payment method supports the following transactions:


Payment

Request

Send a payment request with the following additional data:

Parameter Type Description
method object A section of the payment method information.
type * required
string q_pay
customer object A section of the customer information.
device_id * required
string The customer's ID in the merchant's system.
Example of the payment request
{
  "request":{
      "amount":200,
      "currency":"MNT",
      "description":"description",
      "test": true,
      "tracking_id":"your_unique_number",
      "language":"en",
      "notification_url":"https://example.com/notification",
      "return_url":"https://example.com/return",
      "customer":{
        "device_id": "123456789"
      },
      "method":{
        "type": "q_pay"
      }
  }
}
Response

The payment response additionally contains the transaction.form section with links to mobile banking or payment service applications. Built an HTML form using the following response parameters. Then, redirect the customer to the form, so that the customer can select a suitable bank or payment service:

Parameter Type Description
transaction object A section of transaction details.
form * required
object A section of elements and attributes of an HTML form.
urls array An array of parameters of mobile banking and payment service applications. Each array element represents one application.
name * required
string A short name or international name of a bank or a payment service provider.
description * required
string A full name of a bank or a payment service provider.
logo * required
string A logo of a bank or a payment service provider.
link * required
string A deep link to a mobile banking or payment service application.

Info

By default, a link to a mobile banking and payment service application is valid for 24 hours. To change the link expiration time, submit the expired_at parameter value in a payment request.

Example of the response to a payment request
{
    "transaction": {
        "uid": "1234ccec-56c8-4356-8d53-b081b4a07230",
        "type": "payment",
        "status": "pending",
        "amount": 200,
        "currency": "MNT",
        "description": "description",
        "created_at": "2023-05-04T13:42:47Z",
        "updated_at": "2023-05-04T13:42:51Z",
        "method_type": "q_pay",
        "receipt_url": "https://merchant.bepaid.by/customer/transactions/1234ccec-56c8-4356-8d53-b081b4a07230/735179255e5ff84e8b752f85452563c946f069bbb5cd0fc54541637a095354c0?language=en",
        "payment": {
          "status": "pending",
          "gateway_id": 1234,
          "ref_id": "f123456a-265b-4cd1-9823-2aa7123565fc",
          "message": "Transaction in progress"
        },
        "q_pay": {
          "type": "q_pay"
        },
        "customer": {
          "device_id": "123456789",
          "ip": null
        },
        "message": "Transaction in progress",
        "tracking_id": "your_unique_number",
        "test": true,
        "language": "en",
        "additional_data": {
            "payment_method": {
                "type": "alternative"
            }
        },
        "gateway": {
            "iframe": false
        },
        "form": {
            "urls": [
                {
                    "name":"Khan bank",
                    "description":"\u0425\u0430\u0430\u043D \u0431\u0430\u043D\u043A",
                    "logo":"{a logo URL}",
                    "link":"{an application deep link}"
                },
                {
                    "name":"State bank",
                    "description":"\u0422\u04E9\u0440\u0438\u0439\u043D \u0431\u0430\u043D\u043A",
                    "logo":"{a logo URL}",
                    "link":"{an application deep link}"
                }
            ]
        }
    }
}

Payment status query

Request

If you specify notification_url in the payment request, bePaid sends a webhook notification about a transaction status. Please note, it might take some time for bePaid to get the transaction status confirmation from the payment method provider.

If needed, send a status query request to get the current transaction status.

Example of the status query request
curl --location --request GET 'https://api.bepaid.by/beyag/transactions/1234ccec-56c8-4356-8d53-b081b4a07229' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Shop ID: Secret key' \
--data-raw ''
Response

The response contains the transaction status, a section of the payment method as well as other details related to the payment according to the description of a transaction status query.

Example of the response to a status query request
{
  "transaction": {
        "uid": "1234ccec-56c8-4356-8d53-b081b4a07230",
        "type": "payment",
        "status": "successful",
        "amount": 200,
        "currency": "MNT",
        "description": "description",
        "created_at": "2023-05-04T13:42:47Z",
        "updated_at": "2023-05-04T13:50:51Z",
        "method_type": "q_pay",
        "receipt_url": "https://merchant.bepaid.by/customer/transactions/1234ccec-56c8-4356-8d53-b081b4a07230/735179255e5ff84e8b752f85452563c946f069bbb5cd0fc54541637a095354c0?language=en",
        "payment": {
            "status": "successful",
            "gateway_id": 1234,
            "ref_id": "f123456a-265b-4cd1-9823-2aa7123565fc",
            "message": "Transaction is successful"
        },
        "q_pay": {
            "type": "q_pay"
        },
        "customer": {
            "device_id": "123456789",
            "ip": null
        },
        "message": "Transaction is successful",
        "tracking_id": "your_unique_number",
        "test": true,
        "language": "en",
        "additional_data": {
            "payment_method": {
                "type": "alternative"
            }
        }
    }
}