Promptpay

Overview

Promptpay is a payment method which allows customers to pay by scanning standardized QR codes with mobile banking applications of Thailand banks. Purchases can be processed by using Payment Page and Gate.

General information

Payment method type payments by using QR code
Countries and regions TH
Payment currencies THB
Currency conversion
Purchases +
Payouts
Stored credentials payments
Full refunds
Partial refunds
Chargebacks
Notes the expiration time of the QR-code on the provider side is 6 minutes.
Onboarding and access fee refer to your ECommPay key account manager

Interaction diagram

Payment processing by using the Promptpay payment method requires merchant's web service, one of ECommPay interfaces, and the ECommPay payment platform, as well as provider technical facilities.

Operations support

  Interfaces Amounts, THB Times*
Payment Page CMS Plug-ins Gate Dashboard minimum maximum basic threshold
Purchases + + 500.00 500,000.00 3-4 minutes
* The basic and threshold times are defined as follows:
  • The basic time is the average estimated time between the moment a payment is initiated in the payment platform to the moment the payment result is sent to the initiator. The basic time evaluation is made on the assumption of normal operation of all technical facilities and communication channels and typical customer behaviour (if any input from customer is required). Use the basic time to estimate when to react to the absence of payment result notifications or when to check payment status.
  • The threshold time is the maximum possible time between the moment a payment is initiated in the payment platform to the moment the initiator receives the callback with the payment result. A payment is automatically declined, if its waiting time exceeds the threshold time. For individual setting of the threshold time limit, contact ECommPay technical support.

Processing scenarios

In the Promptpay method, to perform a purchase operation, you need to redirect customer to the provider service.

The sections that follow provide detailed information about what you need to perform payments and how you can analyse the information on payments and operations.

Purchases by using Payment Page

General information

In the Promptpay method, when processing a purchase by using Payment Page, the merchant web service should send a request with all the required parameters and signature to the ECommPay URL and get the callback with the payment result from the payment platform. When opening Payment Page, you can have Payment Page opened with the Promptpay method selected. For more information about preselecting payment methods, see in Preselecting payment method. The full sequence and particularities of the purchase process are provided below.

Figure: Purchase by using Payment Page

  1. A customer initiates a purchase on the merchant's web service.
  2. The web service sends the request for Payment Page opening to the specified ECommPay URL.
  3. The request for opening is redirected to the payment platform.
  4. The payment platform performs the initial request processing that involves validation of the required parameters and signature.
  5. Requested Payment Page is generated into the ECommPay payment platform as specified in the project settings and the request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the Promptpay method.
  8. The payment platform receives the purchase request for payment processing from Payment Page.
  9. The payment platform sends the customer redirection data to Payment Page.
  10. The customer is redirected to the provider website.
  11. The customer completes all the payment steps required.
  12. The payment is processed on the provider side.
  13. The customer is redirected to Payment Page.
  14. The provider service sends the result notification to the payment platform.
  15. The payment platform sends a callback with the payment result to the web service.
  16. The payment platform sends the result to Payment Page.
  17. A page with the payment result information is displayed to the customer on Payment Page.

The sections that follow discuss in more details the request format and the Payment Page parameters to use in the Promptpay payment method and provide the information on the format of callbacks with payment results. For the general information on how to use the API, see Payment Page API Description.

Request format

There are several things you need to consider when using the Promptpay method:

  1. You must provide values for the basic minimum of parameters. Listed below are the parameters that are mandatory for any payment method:
    • project_id—the project ID obtained from ECommPay
    • payment_id—payment ID unique within the project
    • payment_currency—payment currency in ISO-4217 alpha-3 format
    • payment_amount—payment amount in minor units
    • customer_id—customer ID unique within the project
  2. If you need to have payment form displayed with the Promptpay method selected, set the force_payment_method parameter to promptpay.
  3. If required, you can also add any other additional parameters Payment Page supports.
  4. After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.

Thus, a correct payment request in the Promptpay method must include project and payment IDs, the currency and the amount of a payment in the appropriate currency, customer ID, as shown in the following example:

    { payment_id: 'X03936', 
      payment_amount: 1000, 
      payment_currency: 'THB', 
      project_id: 123, 
      customer_id: 'customer1',
      signature: "kUi2x9dKHAVNU0FYldJrxh4yo+5...ZzUCwX6R\/ekpZhkIQg=="
    }

For information about all parameters available in the Promptpay method , see Payment Page invocation parameters.

Callback format

The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 1000.00 THB purchase made by the 123 customer in the 382 project.

Figure: Example of a successful purchase callback

{
        "project_id": 382,
        "payment": {
            "type": "purchase",
            "sum": {
                "amount": 100000,
                "currency": "THB"
            },
            "status": "success",
            "method": "promptpay",
            "id": "cfaf576641101077ec3440ffaf476a9d",
            "date": "2020-09-07T12:44:54+0000"
        },
        "customer": {
            "id": "123"
        },
        "operation": {
            "type": "sale",
            "sum_initial": {
                "currency": "THB",
                "amount": 100000
            },
            "sum_converted": {
                "currency": "THB",
                "amount": 100000
            },
            "status": "success",
            "request_id": "057cdba3b2b54b994a5f9c3c4080ff...fdec3b0b0be6b-00089013",
            "provider": {
                "payment_id": "079253339",
                "id": 3351,
                "date": "2020-09-07T04:44:52+0000"
            },
            "message": "Success",
            "id": 89012010009801,
            "date": "2020-09-07T12:44:54+0000",
            "created_date": "2020-09-07T12:42:17+0000",
            "code": "0"
        },
        "signature": "mwiKFBdPKMUEmDieNYeJ...w0R0GGfIBVExvubTbimclPgfx2/CY8Yq+g=="
    }
}

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

Figure: Example of a declined purchase callback

{
        "project_id": 383,
        "payment": {
            "type": "purchase",
            "sum": {
                "amount": 185384,
                "currency": "THB"
            },
            "status": "decline",
            "method": "promptpay",
            "id": "bde45cdea1ac5c4a75e2d04689a06ad4",
            "date": "2020-09-07T11:01:34+0000"
        },
        "customer": {
            "id": "456"
        },
        "operation": {
            "type": "sale",
            "sum_initial": {
                "currency": "THB",
                "amount": 185384
            },
            "sum_converted": {
                "currency": "THB",
                "amount": 185384
            },
            "status": "decline",
            "request_id": "c7d5631fdd81a4394e85d82...eb70af0e207f1a133-00085510",
            "provider": {
                "payment_id": "079243093",
                "id": 3351,
                "date": "2020-09-07T03:01:32+0000"
            },
            "message": "General decline",
            "id": 85509010009741,
            "date": "2020-09-07T11:01:34+0000",
            "created_date": "2020-09-07T10:09:31+0000",
            "code": "20000"
        },
        "signature": "FEPNq/ijls1WTCdNdz8FD1bM6kWe04AO...Lri/KEHcn/ihMSmzv/cNmQ=="
    }
}

Related topics

The following topics might be useful when implementing payments by using Payment Page:

Purchases by using Gate

General information

In the Promptpay method, when processing a purchase by using Gate, the merchant web service is required to do the following:

  1. Send a request with all the required parameters and signature to the ECommPay URL.
  2. Perform the redirection of a customer to the provider service.
  3. Get the callback with the payment result from the payment platform.

The following diagram provides the detailed picture of the payment processing procedure.

Figure: Purchase by using Gate

  1. A customer initiates a purchase through provider on the merchant's web service side.
  2. The web service sends the request for processing the purchase by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for processing the purchase from Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends the response with request receipt confirmation and correctness check result to the web service. For more information, see Response format.
  6. The payment platform sends the callback with the redirection data in the redirect_data object to the web service.
  7. The customer is redirected from the web service to the provider service.
  8. The customer completes all the payment steps required.
  9. The payment is processed on the provider side.
  10. The customer is redirected to the merchant's web service.
  11. The provider service sends the payment result notification to the payment platform.
  12. The payment platform sends a callback to the web service.
  13. The customer receives the payment result on the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the Promptpay payment method and provide the information on the format of callbacks with purchase results.

Request format

There are several things you must consider when using purchase requests in the Promptpay method:
  1. You send purchase requests by sending the /v2/payment/banks/promptpay/sale request by using the POST HTTP method . This request belongs to the following request group /v2/payment/banks/{payment_method}/sale.
  2. The following objects and parameters must be specified in any request:
    • Object general—general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification.
    • Object payment—payment information:
      • amount—purchase amount in minor units
      • currency—purchase currency in ISO-4217 alpha-3 format
    • Object customer—customer information:
      • id—identifier
      • ip_address—customer IP address
    • Object return_url—URL for redirecting a customer from the provider website:
      • success—URL for redirecting a customer after a performed purchase
  3. If required, you can also add any other additional parameters Gate supports.

Thus, a correct payment request in the Promptpay method must include project and payment IDs, currency and amount of the purchase, identifier and IP address of the customer, as well as the URL for customer redirection, as shown in the following example:

Figure: Example of a purchase request

{
    "general": {
    "project_id": 125,
    "payment_id": "ID_184",
    "signature": "PJkV8ej\/UG0Di8hTng6JvC7vQsaC6tajQVVLhNN5e7cV+VHq3L
                        wY3T\/pOMeSaRfBaNIipTv+AWoXW\/9MTO8yJA=="
  },
  "payment": {
    "amount": 10000,
    "currency": "THB"
  },
  "customer": {
    "ip_address": "1.1.1.1",
    "id": "123"
  },
    "return_url":{
      "success" : "http://example.com"
  }
}

Formats of the customer redirection data

To redirect a customer from the web service to the provider site, you must receive a callback from the payment platform containing the URL for redirection in the redirect_data.url parameter and data to be sent in the request body in the redirect_data.body parameter, and use these parameters when opening the HTML page using the method specified in the redirect_data.method parameter.

The following is the callback fragment containing the redirection data.

    "redirect_data":{
        "url":"http://api.example.biz/MerchantTransfer",
        "method":"POST",
        "body":{
            "Reference":"2000016",
            "Amount": "58.00",
            "Merchant": "M0114",
            "Currency": "THB",
            "Key": "21312434tgdfgdjif",
            "Datetime":"2017-09-19 02:55:00PM",
            "FrontURI": "http://example.com",
            "BackURI": "http://test.example2.com",
            "Bank":"123",
            "Language": "en-us",
            "ClientIP":"183.171.94.142",
            "Customer":"tester77"
            }
         }

Callback format

The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 1000.00 THB purchase made by the 123 customer in the 382 project.

Figure: Example of a successful purchase callback

{
        "project_id": 382,
        "payment": {
            "type": "purchase",
            "sum": {
                "amount": 100000,
                "currency": "THB"
            },
            "status": "success",
            "method": "promptpay",
            "id": "cfaf576641101077ec3440ffaf476a9d",
            "date": "2020-09-07T12:44:54+0000"
        },
        "customer": {
            "id": "123"
        },
        "operation": {
            "type": "sale",
            "sum_initial": {
                "currency": "THB",
                "amount": 100000
            },
            "sum_converted": {
                "currency": "THB",
                "amount": 100000
            },
            "status": "success",
            "request_id": "057cdba3b2b54b994a5f9c3c4080ff...fdec3b0b0be6b-00089013",
            "provider": {
                "payment_id": "079253339",
                "id": 3351,
                "date": "2020-09-07T04:44:52+0000"
            },
            "message": "Success",
            "id": 89012010009801,
            "date": "2020-09-07T12:44:54+0000",
            "created_date": "2020-09-07T12:42:17+0000",
            "code": "0"
        },
        "signature": "mwiKFBdPKMUEmDieNYeJ...w0R0GGfIBVExvubTbimclPgfx2/CY8Yq+g=="
    }
}

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

Figure: Example of a declined purchase callback

{
        "project_id": 383,
        "payment": {
            "type": "purchase",
            "sum": {
                "amount": 185384,
                "currency": "THB"
            },
            "status": "decline",
            "method": "promptpay",
            "id": "bde45cdea1ac5c4a75e2d04689a06ad4",
            "date": "2020-09-07T11:01:34+0000"
        },
        "customer": {
            "id": "456"
        },
        "operation": {
            "type": "sale",
            "sum_initial": {
                "currency": "THB",
                "amount": 185384
            },
            "sum_converted": {
                "currency": "THB",
                "amount": 185384
            },
            "status": "decline",
            "request_id": "c7d5631fdd81a4394e85d82...eb70af0e207f1a133-00085510",
            "provider": {
                "payment_id": "079243093",
                "id": 3351,
                "date": "2020-09-07T03:01:32+0000"
            },
            "message": "General decline",
            "id": 85509010009741,
            "date": "2020-09-07T11:01:34+0000",
            "created_date": "2020-09-07T10:09:31+0000",
            "code": "20000"
        },
        "signature": "FEPNq/ijls1WTCdNdz8FD1bM6kWe04AO...Lri/KEHcn/ihMSmzv/cNmQ=="
    }
}

Related topics

The following topics might be useful when implementing payments through Gate:

Analysis of payments results

As with other payment methods ECommPay offers, when using the Promptpay method, you have several options to analyse the information about payments and operations performed by using the method—alone or in conjunction with other methods.

You can load and analyse all the necessary information in Dashboard, for instance you can use the analytic panels on the Analytics tab to this end.

Also, you can export the information for further analysis by using third party analytical tools. The following options are available:

  • Dashboard allows you to download reports in CSV and XLS formats—by using the tools on the Payments tab. You can perform export as a one-time download to your local computer or have payment data regularly exported and delivered to email addresses you specify.
  • Data API allows you to have payment information exported in JSON format and delivered to a URL you specify. The payment information is exported by using the /operations/get queries.

If you have any further questions regarding payment data analysis, contact ECommPay technical support.