QR code payment

General information

You can request from JetPay a QR code which you can use to have your customer scan it to open the checkout page and complete the purchase. Once your customer opens the checkout page, the purchase is processed as usual as described in Purchase processing with Payment Page.

QR code purchase workflow

To perform a QR code purchase:

  1. Send a request for a QR purchase with all the required parameters and signature to https://paymentpage.jetpay.kz/payment/generate-qr.
  2. Accept the HTTP response with the data for displaying the QR code to the customer.
  3. Accept the callback with the purchase result from the payment platform.

Request

The following table lists the parameters that you need to include in the request for the QR purchase.

Table 1. Basic parameters of the QR purchase request

strictly required—the parameter must be in the initial request.

Parameter Description

project_id
integer
strictly required

Project ID you obtained from JetPay when integrating.

Example: 123

payment_id
string
strictly required

Payment ID unique within your project.

Example: payment_47

payment_currency
string
strictly required

Code of the purchase currency in the ISO-4217 alpha-3 format.

Example: KZT

payment_amount
integer
strictly required

Purchase amount in minor currency units without any decimal point or comma except for the cases when the currency doesn't have any minor currency units. If the currency doesn't have any minor units (i.e. the number of digits for minor currency units is zero), set this parameter to the amount in the major currency units. To check whether the currency has any minor units, see Currency codes.

Example: 100.00 KZT must be sent as 10000

customer_first_name
string
strictly required

Customer's first name.

Example: John

customer_last_name
string
strictly required

Customer's last name.

Example: Doe

customer_email
string
strictly required

Customer's email.

Example: johndoe@example.com

customer_id
string
strictly required

Unique ID of the customer within your project.

Example: customer_123

signature
string
strictly required

Signature created after you've specified all the request parameters. For more information about signature generation, see Signature generation and verification.
You can also add any other optional parameters to the request, if necessary. For the list of all the parameters possible in requests to Payment Page, see Payment Page invocation parameters.

Here is an example of the data from a QR purchase request:

EPayWidget.run(
    {
        project_id: 123,
        payment_id: 'payment_47',
        customer_id: 'customer_123',
        customer_first_name: 'John',
        customer_last_name: 'Doe',
        customer_email: 'johndoe@example.com',
        payment_currency: 'KZT',
        payment_amount: 10000,  
        signature: 'kUi2x9dKHAVNU0FYldJrxh4yo...UCwX6R\/ekpZhkIQg=='
    }
)

Figure: Example of a GET request for a QR purchase

https://paymentpage.jetpay.kz/payment/generate-qr?payment_currency=KZT&language_code=en&project_id=123&payment_amount=10000&customer_id=customer_123&payment_id=payment_47&signature=J5EVIByEojBn...etmdMozpECuRxOw%3D%3D

Response

After submitting the request, you will receive the HTTP response from the payment platform with the data for displaying the QR code to the customer. For more information about responses, see Response.

The img_src parameter displays base64 coded data, you need to decode to get the QR code image. Integrate this image into your website or mobile app so that your customer can scan it and complete the purchase.

Figure: Example of the response with the data for the QR code

{
    "img_src": "data:image/png;base64,iVBORw0KGgoAAAC+CAIi...2zk8HAU1QkMAAAORK5CYII="
}

Callback

The payment platform returns the purchase result in a callback. For the information about the callback structure, see Callbacks in Payment Page.

Figure: Example of the data from a successful purchase callback

{
    "project_id": 123,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "method": "mobile",
        "sum": {
            "amount": 10000,
            "currency": "KZT"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 28,
        "type": "sale",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "created_date": "2022-03-25T11:08:05+0000",
        "request_id": "9e32835fb27907e0b085636c5117242b5cf60a4e17839",
        "sum_initial": {
            "amount": 10000,
            "currency": "KZT"
        },
        "sum_converted": {
            "amount": 10000,
            "currency": "KZT"
        },
        "code": "0",
        "message": "Success",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-321",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhM...oB3cs9CRd4xeYG2Q=="
}