Scenario 2. Purchase with a QR code

When performing a purchase, the customer scans the QR code displayed on the checkout page or in your system (when performing the purchase by using Gate).

Countries and regions Philippines
Payment currencies PHP
Payment amount limits Contact your key account manager at Monetix for details. Also you can check the payment amount limits in your project by using Dashboard.
Payment processing time Contact your key account manager at Monetix for details.
Currency conversion On the Monetix side
Refund
Onboarding and access fee Contact your key account manager at Monetix for details.

Operations support

Interfaces
Payment Page Gate Dashboard
Purchase

You can check the payment amount limits in your project by using Dashboard. To check your payment amount limits, go to Dashboard, select the Projects section, and then click the Payment methods tab.

The following sections provide more information about the payment processing flow and the analysis of completed payments.

Purchase by using Payment Page

General information

To perform a purchase by using Payment Page with the QR Ph payment method:

  1. Send a request with all the required parameters and signature to the Monetix URL.
  2. Accept the callback with the purchase result from the payment platform.

The following figure shows the complete purchase processing flow in the QR Ph payment method.

Figure 1. Purchase processing steps for a purchase by using Payment Page
  1. The customer initiates a purchase in your system.
  2. Your system sends the request for the purchase through Payment Page to the Monetix URL.
  3. The checkout page is displayed to the customer.
  4. The customer chooses to make a purchase with the QR Ph payment method.
  5. The payment platform processes the request and forwards it to the provider service.
  6. The provider service generates and sends the payment QR code data to the payment platform.
  7. The checkout page displays the QR code to the customer.
  8. The customer completes the purchase.
  9. The provider service sends the purchase result information to the payment platform.
  10. The payment platform sends a callback with the payment result to your system.
  11. The payment platform displays the payment result to the customer on the checkout page.

Request

The following table lists the parameters that you need to include in the request for purchase through the checkout page with the QR Ph payment method.

Table 1. Basic parameters of requests to Payment Page

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

optional—the parameter is optional but adding it to the request either makes the payment process more customer-friendly or helps to increase the percentage of successful payments.

ParameterDescription

project_id
integer
strictly required

Project ID you obtained from Monetix when integrating.

Example: 1234

payment_id
string
strictly required

Payment ID unique within your project.

Example: payment_47

customer_id
string
strictly required

Unique ID of the customer within your project.

Example: customer_123

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

payment_currency
string
strictly required

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

Example: PHP

payment_amount
integer
strictly required

Payment 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 PHP must be sent as 10000

force_payment_method
string
optional

Parameter that allows you to enforce the QR Ph payment method for your customer and skip the page with payment method selections.

To enforce the QR Ph payment method and skip the page with payment method selection, add the force_payment_method parameter to the request and set its value to ph-qr. For more information about enforcing payment methods, see Preselecting payment methods.

Example: force_payment_method: 'ph-qr'

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 request to open the checkout page by using EPayWidget:

EPayWidget.run(
	{
		project_id: 1234,
		payment_id: 'payment_47',
		customer_id: 'customer_123',
		customer_first_name: 'John',
		customer_last_name: 'Doe',
		customer_email: 'johndoe@example.com',
		payment_currency: 'PHP',
		payment_amount: 10000,
		force_payment_method: 'ph-qr',
		signature: 'kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y19vySO/RLUkDJrOcZzUCwX6R/ekpZhkIQg=='
	}
)

Callback

In the QR Ph payment method, the payment platform returns the purchase result in a callback. For the information about the callback structure, see Callbacks in Payment Page.

The following is an example of a callback body with information about a successfully completed purchase.

Figure 2. Example of the data from a successful purchase callback
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "success",
        "date": "2024-12-07T19:08:45+0000",
        "method": "QRPH",
        "sum": {
            "amount": 10000,
            "currency": "PHP"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 47,
        "type": "sale",
        "status": "success",
        "date": "2024-12-07T19:08:45+0000",
        "created_date": "2024-12-07T19:08:05+0000",
        "request_id": "1a23456bc7890de",
        "sum_initial": {
            "amount": 10000,
            "currency": "PHP"
        },
        "sum_converted": {
            "amount": 10000,
            "currency": "PHP"
        },
        "code": "0",
        "message": "Success",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-123",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPKdM4XrUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}

The following is an example of a callback for a declined purchase.

Figure 3. Example of the data from a declined purchase callback
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "decline",
        "date": "2024-12-07T19:08:45+0000",
        "method": "QRPH",
        "sum": {
            "amount": 10000,
            "currency": "PHP"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 47,
        "type": "sale",
        "status": "decline",
        "date": "2024-12-07T19:08:45+0000",
        "created_date": "2024-12-07T19:08:05+0000",
        "request_id": "1a23456bc7890de",
        "sum_initial": {
            "amount": 10000,
            "currency": "PHP"
        },
        "sum_converted": {
            "amount": 10000,
            "currency": "PHP"
        },
        "code": "20000",
        "message": "General decline",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-123",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPKdM4XrUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}

Purchase by using Gate

General information

To perform a purchase by using Gate with the QR Ph payment method:

  1. Send a request with all the required parameters and signature to the Monetix URL.
  2. Show the screen with a payment QR code to the customer.
  3. Accept the callback with the purchase result from the payment platform.

The following figure provides the details of the purchase processing flow in the QR Ph payment method.

Figure 4. Purchase processing flow when performing a purchase by using Gate
  1. The customer initiates a purchase in your system.
  2. Your system sends the purchase request to the Monetix payment platform.
  3. The payment platform sends you a response in which it acknowledges your request and provides the request validation result. (For more information about the response format, see Response structure.)
  4. The payment platform processes the request and forwards it to the provider service.
  5. The provider service generates and sends the payment QR code data to the payment platform.
  6. The payment platform sends the data to your system in the display_data array.
  7. Your system displays the QR code to the customer.
  8. The customer completes the purchase.
  9. The provider service informs the payment platform about the purchase result.
  10. The payment platform sends the callback with the payment result to your system.
  11. Your system sends the payment result to the customer.

Request

This section provides the instructions on how to build the request for purchase with the QR Ph payment method.

HTTP request method POST
Request body format JSON
API endpoint/v2/payment/qr/ph-qr/sale
Full API endpoint specification /v2/payment/qr/{payment_method}/sale
Table 2. Basic parameters of a purchase request

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

ObjectParameterDescription

general
object
strictly required

project_id
integer
strictly required

Project ID you obtained from Monetix when integrating.

Example: 1234

payment_id
string
strictly required

Payment ID unique within your project.

Example: payment_47

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.

customer
object
strictly required

id
string
strictly required

Unique ID of the customer within your project.

Example: customer_123

ip_address
string
strictly required

IP address of the customer's device.

Example: 198.51.100.47

first_name
string
strictly required

Customer's first name.

Example: John

last_name
string
strictly required

Customer's last name.

Example: Doe

email
string
strictly required

Customer's email.

Example: johndoe@example.com

payment
object
strictly required

currency
string
strictly required

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

Example: PHP

amount
integer
strictly required

Payment 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 PHP must be sent as 10000

You can also add any other optional parameters to the purchase request, if necessary. For the list of all the parameters available in Gate, see API Reference.

Here is an example of the data from a request to initiate a purchase with the QR Ph payment method:

Figure 5. Example of the purchase request body
{
    "general": {
        "project_id": 1234,
        "payment_id": "payment_47",
        "signature": "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y19vySO/RLUkDJrOcZzUCwX6R/ekpZhkIQg=="
    },
    "customer": {
        "id": "customer_123",
        "ip_address": "198.51.100.47",
        "first_name": "John",
        "last_name": "Doe",
        "email": "johndoe@example.com"
    },
    "payment": {
        "currency": "PHP",
        "amount": 10000
    }
}

Displaying the payment QR code to the customer

After receiving and processing your purchase request, the payment platform sends you the callback with the data for displaying the payment QR code to the customer.

Use the data from the display_data array to display the QR code to the customer.

There are two ways the display_data array can be structured. All of them are described below. Ask your key account manager at Monetix which option is relevant to you.

Option 0

The display_data array contains the following parameters:

  • type—element type. The value of this parameter is always qr_img.
  • title—name of the data. The value of this parameter is always qr_img.
  • data—data that should be encoded in the QR code.

Here is an example of the callback snippet with the data for displaying the QR code to the customer.

"display_data": [
    {
        "type": "qr_img",
        "title": "qr_img",
        "data": "data:image/png;base64,iVB..."
    }
]

Option 1

The display_data array contains the following parameters:

  • type—element type. The value of this parameter is always qr_img.
  • title—name of the data. The value of this parameter is always QR code.
  • data—data that should be encoded in the QR code.

Here is an example of the callback snippet with the data for displaying the QR code to the customer.

"display_data": [
    {
        "type": "qr_img",
        "title": "QR code",
        "data": "data:image/png;base64,iVB..."
    }
]

Callback

In the QR Ph payment method, the payment platform returns the purchase result in a callback. For the information about the callback structure, see Callbacks in Gate.

The following is an example of a callback body with the information about a successfully completed purchase.

Figure 6. Example of the data from a successful purchase callback
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "success",
        "date": "2024-12-07T19:08:45+0000",
        "method": "QRPH",
        "sum": {
            "amount": 10000,
            "currency": "PHP"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 47,
        "type": "sale",
        "status": "success",
        "date": "2024-12-07T19:08:45+0000",
        "created_date": "2024-12-07T19:08:05+0000",
        "request_id": "1a23456bc7890de",
        "sum_initial": {
            "amount": 10000,
            "currency": "PHP"
        },
        "sum_converted": {
            "amount": 10000,
            "currency": "PHP"
        },
        "code": "0",
        "message": "Success",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-123",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPKdM4XrUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}

The following is an example of a callback for a declined purchase.

Figure 7. Example of the data from a declined purchase callback
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "decline",
        "date": "2024-12-07T19:08:45+0000",
        "method": "QRPH",
        "sum": {
            "amount": 10000,
            "currency": "PHP"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 47,
        "type": "sale",
        "status": "decline",
        "date": "2024-12-07T19:08:45+0000",
        "created_date": "2024-12-07T19:08:05+0000",
        "request_id": "1a23456bc7890de",
        "sum_initial": {
            "amount": 10000,
            "currency": "PHP"
        },
        "sum_converted": {
            "amount": 10000,
            "currency": "PHP"
        },
        "code": "20000",
        "message": "General decline",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-123",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPKdM4XrUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}