# Promptpay {#pm_promptpay} **Parent topic:**[QR code payments](en_pm_qr.md) ## Overview {#en_pm_promptpay_overview} An article about the payment method which allows you to process payments in Thai bahts by using bank accounts in Thailand and supports purchases. ### Introduction {#section_t5z_rlg_ytb .section} Promptpay is a payment method which allows to process payments in Thai bahts by using bank accounts in Thailand.This method supports purchases, two channels can be used for purchase processing—channel 1 involves redirection of the customer to the provider service, and channel 2 is performed without the redirection of the customer. For more information about the applicable processing channel, refer to your Ecommpay key account manager. This article provides information about working with the Promptpay method: general insights are presented in the Overview section, while information about the actions required to process payments and perform other actions is presented in the sections that follow. ### General information {#section_tbf_2zk_ggb .section} |Payment method type|QR code payments| |Payment instruments|bank accounts| |Countries and regions|[TH](references/en/countries/TH.md)| |Payment currencies|[THB](references/en/currencies/THB.md)| |Currency conversion|–| |One-time purchases|+| |Credential-on-file purchases|–| |Full refunds|–| |Partial refunds|–| |Payouts|–| |Chargebacks|–| |Notes|- for purchase processing with redirection of the customer to the provider service the expiration time of the QR code on the provider side is 6 minutes. - for purchase processing without redirection of the customer to the provider service the expiration time of the QR code on the side of the Ecommpay payment platform can be configured. To set the expiration time of the QR code, contact Ecommpay technical support specialists. | |Onboarding and access fee|refer to your Ecommpay account manager; more information is available in [Ecommpay shop](https://ecommpay.com/shop/payment-methods/promtpay/)| ### Interaction diagram {#section_tsp_gzk_ggb .section} Payment processing by using the Promptpay method involves the merchant's web service, one of Ecommpay interfaces, the Ecommpay payment platform, and technical facilities of the provider service. ![](images/pm/eng_promptpay_functional.svg) ### Operations support {#section_rnx_4cl_ggb .section} Various platform interfaces can be used to process payments and perform operations using the Promptpay method. Purchases can be processed by using Payment Page, Gate and Dashboard \(using payment links\), refunds and payouts—by using Gate and Dashboard. At the same time, regardless of the interfaces used, the following properties are applicable. | |Timespans ²| |basic time|threshold time| |--|-----------| |----------|--------------| |Purchases|3-4 minutes|–| **Note:** 1. The base and threshold times are defined as follows: - *The base 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 web service. The base time evaluation is made on the assumption of normal operation of all technical facilities and communication channels and typical customer behaviour. Use the base time to estimate when to react to the absence of payment result callbacks or when to check payment status \([details](en_Gate_payment_status_request.md#)\). - *The threshold time* is the maximum possible time between the moment a payment is initiated in the payment platform to the moment the web service receives the callback with the payment result. A payment is automatically assigned the `decline` status if it wasn't processed within the threshold time. For individual customisation of the threshold time limit, contact Ecommpay technical support. ### Processing scenarios {#section_fgt_sdl_ggb .section} To perform a purchase by using the Promptpay method, you need to redirect customer to the provider service or display the payment instructions to the customer. The customer payment scenario via Payment Page \(in the case where the customer chooses the method and is redirected to the provider service and returned from the final page of the payment form to the web service\) looks like this. ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_1.svg "Proceeding to payment") ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_2.svg "Selecting method") ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_3.svg "Receiving instructions") ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_4.svg "Paying according to instructions") ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_5.svg "Redirecting to the payment form") ![](images/pm/pp_scenario/en_pp_customer_scenario_promptpay_6.svg "Redirecting to the web service") General scenarios of processing purchases can be presented as follows. ![](images/pm/eng_promptpay_interfaces_pp.svg "Purchase by using Payment Page with redirection of the customer") ![](images/pm/eng_promptpay_app_interfaces_pp.svg "Purchase by using Payment Page without redirection of the customer") ![](images/pm/eng_promptpay_interfaces_gate.svg "Purchase by using Gate with redirection of the customer") ![](images/pm/eng_promptpay_app_interfaces_gate.svg "Purchase by using Gate without redirection of the customer") Scenarios for performing operations via the main interfaces of the payment platform correspond to those presented in the diagrams. Similarly, when additional features \(such as payment links\) are used, scenarios for performing operations also correspond to the specifics of those features. ## Purchases by using Payment Page. Channel 1: with redirection of the customer {#en_pm_promptpay_pp_purchase} ### General information {#section_gtg_vxk_m2b .section} To process a purchase through Payment Pageby using the Promptpay method, the merchant's web service is required to send a request with all required parameters and signature to the Ecommpay URL and receive a callback with the result.The full sequence and special aspects of purchase processing are provided below. ![](images/pm/eng_promptpay_uml_pp.svg) 1. A customer initiates a purchase in the web service. 2. The web service sends the request for opening Payment Page to the specified Ecommpay URL. 3. The request for opening Payment Page is sent to the payment platform. 4. The payment platform receives the request and validates the required parameters and signature. 5. Payment Page is generated based on the project and request parameters. 6. Payment Page is displayed to the customer. 7. The customer selects the Promptpay method. 8. The payment platform receives the request for processing the payment by using the Promptpay method. 9. The payment platform performs the internal purchase request processing. 10. The data for redirecting the customer is sent from the payment platform to Payment Page. 11. The customer is redirected to the provider service. 12. The customer completes all required payment steps. 13. The purchase is processed in the provider service. 14. The customer is redirected to Payment Page. 15. The provider service sends a notification about the result to the payment platform. 16. The payment platform sends the payment result callback to the web service. 17. The payment platform sends the result information to Payment Page. 18. The result information is displayed to the customer on Payment Page. Information about the formats of requests and callbacks used for processing payments by using the Promptpay method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in [Interaction concepts](en_pp_interaction_organisation.md#). ### Request format {#section_p5j_fgl_ggb .section} There are several things you need to consider when using the Promptpay method: 1. The following parameters required for any payment must be specified: - `project_id`—project identifier obtained from Ecommpay during integration - `payment_id`—payment identifier unique within the project - `payment_currency`—payment currency code in the ISO-4217 alpha-3 format - `payment_amount`—payment amount in the smallest currency unit - `customer_id`—customer identifier unique within the project 2. The currency of payment can only be [THB](references/en/currencies/THB.md). 3. If you need to have the payment form displayed with the Promptpay method selected, set the `force_payment_method` parameter to `promptpay`. 4. Additionally, any other parameters available for working with Payment Page can be used \([details](en_PP_Parameters.md)\). 5. After all target parameters are specified, generate a signature \([details](en_platform_signature.md#)\). Thus, a correct request for opening the payment form using the Promptpay method must contain the project identifier, basic payment information \(identifier, amount, and currency code\), customer identifier and signature. ```language-json { "project_id": 120, "payment_id": "580", "payment_amount": 1000, "payment_currency": "THB", "customer_id": "customer1", "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg==" } ``` ```language-json { "project_id": 120, "payment_id": "580", "payment_amount": 1000, "payment_currency": "THB", "customer_id": "customer1", "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg==" } ``` ### Callback format {#section_dpx_2hl_ggb .section} The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see [Handling callbacks](en_platform_callbacks.md#). The following is the example of a callback with information about a `1000.00 THB` purchase made by the `123` customer in the `382` project. ```language-json { "project_id": 382, "payment": { "type": "purchase", "sum": { "amount": 100000, "currency": "THB" }, "status": "success", "method": "promptpay", "id": "580", "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 with information about a declined purchase. ```language-json { "project_id": 383, "payment": { "type": "purchase", "sum": { "amount": 185384, "currency": "THB" }, "status": "decline", "method": "promptpay", "id": "580", "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==" } } ``` ### Useful links {#section_xpz_thl_ggb .section} The following articles can be useful when implementing purchases via Payment Page: - [Interaction concepts](en_pp_interaction_organisation.md#)—about the interaction with the payment platform by using Payment Page. - [Signature generation and verification](en_platform_signature.md#)—about the procedure of generating and verifying signatures in requests and callbacks. - [Payment processing](en_platform_payment_model.md)—about the types, processing models, and possible statuses of supported payments and operations. - [One-time one-step purchase](en_platform_sms_model.md)—about processing of one-time one-step purchasesby using Payment Page. - [Handling operation processing information](en_platform_payment_info_codes.md)—about error and response codes that are used in the payment platform to record information about performing of operations. ## Purchases by using Payment Page. Channel 2: without redirection of the customer {#en_pm_promptpay_app_pp_purchase} ### General information {#section_gtg_vxk_m2b .section} To process a purchase through Payment Pageby using the Promptpay method, the merchant's web service is required to send a request with all required parameters and signature to the Ecommpay URL and receive a callback with the result.The full sequence and special aspects of purchase processing are provided below. ![](images/pm/eng_promptpay_app_uml_pp.svg) 1. A customer initiates a purchase in the web service. 2. The web service sends the request for opening Payment Page to the specified Ecommpay URL. 3. The request for opening Payment Page is sent to the payment platform. 4. The payment platform receives the request and validates the required parameters and signature. 5. Payment Page is generated based on the project and request parameters. 6. Payment Page is displayed to the customer. 7. The customer selects the Promptpay method. 8. The request for processing the payment by using the Promptpay method is received by the payment platform. 9. The payment platform processes the request. 10. The data for displaying the payment instructions to the customer is sent from the provider service to the payment platform. 11. The payment instructions are displayed to the customer. 12. The customer completes all required payment steps. 13. The purchase is processed in the provider service. 14. The provider service sends a notification about the result to the payment platform. 15. The payment platform sends the payment result callback to the web service. 16. The payment platform sends the result information to Payment Page. 17. The result information is displayed to the customer on Payment Page. Information about the formats of requests and callbacks used for processing payments by using the Promptpay method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in [Interaction concepts](en_pp_interaction_organisation.md#). ### Request format {#section_p5j_fgl_ggb .section} There are several things you need to consider when using the Promptpay method: 1. The following parameters required for any payment must be specified: - `project_id`—project identifier obtained from Ecommpay during integration - `payment_id`—payment identifier unique within the project - `payment_currency`—payment currency code in the ISO-4217 alpha-3 format - `payment_amount`—payment amount in the smallest currency unit - `customer_id`—customer identifier unique within the project 2. The currency of payment can only be [THB](references/en/currencies/THB.md). 3. If you need to have the payment form displayed with the Promptpay method selected, set the `force_payment_method` parameter to `promptpay`. 4. Additionally, any other parameters available for working with Payment Page can be used \([details](en_PP_Parameters.md)\). 5. After all target parameters are specified, generate a signature \([details](en_platform_signature.md#)\). Thus, a correct request for opening the payment form using the Promptpay method must contain the project identifier, basic payment information \(identifier, amount, and currency code\), customer identifier and signature. ```language-json { "project_id": 120, "payment_id": "580", "payment_amount": 1000, "payment_currency": "USD", "customer_id": "customer1", "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg==" } ``` ```language-json { "project_id": 120, "payment_id": "580", "payment_amount": 1000, "payment_currency": "USD", "customer_id": "customer1", "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg==" } ``` ### Callback format {#section_dpx_2hl_ggb .section} The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see [Handling callbacks](en_platform_callbacks.md#). The following is the example of a callback with information about a `1000.00 THB` purchase made by the `123` customer in the `456` project. ```language-json { "project_id": 456, "payment": { "id": "580", "type": "purchase", "status": "success", "date": "2021-02-15T10:34:21+0000", "method": "promptpay", "sum": { "amount": 100000, "currency": "THB" }, "description": "" }, "customer": { "id": "123" }, "operation": { "id": 76, "type": "sale", "status": "success", "date": "2021-02-15T10:34:21+0000", "created_date": "2021-02-15T10:33:59+0000", "request_id": "a8ee115e2c7f2f9cd69a743f...c161bf1fcde0-00000001", "sum_initial": { "amount": 100000, "currency": "THB" }, "sum_converted": { "amount": 100000, "currency": "THB" }, "code": "0", "message": "Success", "provider": { "id": 4821, "payment_id": "0123456789", "auth_code": "", "date": "2021-02-15T10:34:13+0000" } }, "signature": "+II2IHZ3IjQcqVsIZ9oYb...atXOn2Czyo7L8g9NN1+WVtR+MGQ==" } } ``` The following is the example of a callback with information about a declined purchase. ```language-json { "project_id": 321, "payment": { "id": "580", "type": "purchase", "status": "decline", "date": "2021-03-11T14:01:41+0000", "method": "promptpay", "sum": { "amount": 100000, "currency": "THB" }, "description": "" }, "operation": { "id": 123456789, "type": "sale", "status": "decline", "date": "2021-03-11T14:01:41+0000", "created_date": "2021-03-11T07:07:18+0000", "request_id": "09916aa29732a5e59890c409adaa1fd671...ca33-00088600", "sum_initial": { "amount": 100000, "currency": "THB" }, "sum_converted": { "amount": 100000, "currency": "THB" }, "code": "20000", "message": "General decline", "provider": { "id": 4821, "payment_id": "0123456789", "auth_code": "" } }, "signature": "Lk+5aUd6Hp3lR6ZRPXXA0vJ78tdwOrY80kTp...2f1ilyK1bkNrYw==" } } ``` ### Useful links {#section_xpz_thl_ggb .section} The following articles can be useful when implementing purchases via Payment Page: - [Interaction concepts](en_pp_interaction_organisation.md#)—about the interaction with the payment platform by using Payment Page. - [Signature generation and verification](en_platform_signature.md#)—about the procedure of generating and verifying signatures in requests and callbacks. - [Payment processing](en_platform_payment_model.md)—about the types, processing models, and possible statuses of supported payments and operations. - [One-time one-step purchase](en_platform_sms_model.md)—about processing of one-time one-step purchasesby using Payment Page. - [Handling operation processing information](en_platform_payment_info_codes.md)—about error and response codes that are used in the payment platform to record information about performing of operations. ## Purchases by using Gate. Channel 1: with redirection of the customer {#en_pm_promptpay_gate_purchase} ### General information {#section_lsx_3jl_ggb .section} To process a purchase through Gate by using the Promptpay method, the merchant's web service is required to do the following: 1. Send a request with all the required parameters and signature to the Ecommpay URL. 2. Receive an intermediate callback from the payment platform and redirect the customer to the Promptpay service. 3. Receive the final callback from the payment platform. The full sequence and special aspects of purchase processing are provided below. ![](images/pm/eng_promptpay_uml_gate.svg) 1. A customer initiates a purchase by using the Promptpay method in the web service. 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. 4. The payment platform validates the required parameters and signature in the request. 5. The payment platform sends the response to the web service with information about the receipt of the request and its validity \([details](en_gate_interaction_organisation.md#)\). 6. The payment platform performs the internal purchase request processing. 7. The payment platform sends the callback with the redirection data to the web service. 8. The customer is redirected from the web service to the provider service. 9. The customer completes all required payment steps. 10. The purchase is processed in the provider service. 11. The customer is redirected to the web service. 12. The provider service sends the payment result notification to the payment platform. 13. The payment platform sends the payment result callback to the web service. 14. The customer receives the payment result information from the web service. Information about the formats of requests and callbacks used for processing payments by using the Promptpay method via Gate is presented further in this section. General information about working with the Gate API is presented in [Interaction concepts](en_gate_interaction_organisation.md#). ### Request format {#section_osx_3jl_ggb .section} There are several things you need to consider when sending purchase requests by using the Promptpay method: 1. To initiate each purchase, send a separate POST request to the `/v2/payment/banks/promptpay/sale` endpoint. This endpoint belongs to the \]\] group [/v2/payment/banks/\{payment\_method\}/sale](https://api-developers.ecommpay.com/api-specification/banks/post-v2-payment-banks-payment-method-sale). 2. Each request must include the following objects and parameters: - Object `general`—general purchase information: - `project_id`—project identifierobtained from Ecommpay during integration - `payment_id`—payment identifierunique within the project - `signature`—request signaturegenerated after all required parameters are specified \(details—in the [Signature generation and verification](en_platform_signature.md#)\) - Object `payment`—payment information: - `amount`—payment amount in the smallest currency unit - `currency`—payment currency codein the ISO-4217 alpha-3 format - Object `customer`—customer information: - `id`—customer identifierunique within the project - `ip_address`—customer IP addressrelevant for the initiated payment - Object `return_url`—URL for redirecting a customer from the provider website: - `success`—URL for redirecting a customer after a processed purchase 3. The currency of purchase can only be [THB](references/en/currencies/THB.md). 4. Additionally, any other parameters included in the specification can be used. Thus, a correct purchase request by using the Promptpay method must contain the project identifier, basic payment information \(identifier, amount, and currency code\), customer identifier and IP address, URL for customer redirection, as well as signature. ```language-json { "general": { "project_id": 125, "payment_id": "1234567", "signature": "GINgwlggTvpF9AnlYc9Mtb3LvE4...JChDjj40xI5vOA7w==" }, "customer": { "id": "123", "ip_address": "192.0.2.0" }, "payment": { "amount": 10000, "currency": "THB" }, "return_url": { "success" : "http://example.com" } } ``` ```language-json { "general": { "project_id": 125, "payment_id": "1234567", "signature": "GINgwlggTvpF9AnlYc9Mtb3LvE4...JChDjj40xI5vOA7w==" }, "customer": { "id": "123", "ip_address": "192.0.2.0" }, "payment": { "amount": 10000, "currency": "THB" }, "return_url": { "success" : "http://example.com" } } ``` ### Formats of intermediate callbacks for customer redirection {#section_nxg_hmn_zgb .section} Each payment made with the Promptpay method requires redirection of customers from the merchant's web service to the Promptpay service. To redirect a customer it is necessary to receive an intermediate callback from the payment platform and use the information included in the `redirect_data` object. The format of such callbacks is standard \([details](en_platform_callbacks.md#)\), and the following objects and parameters are included in the `redirect_data` object: - `body`—object with data to be sent in the request body - `method`—parameter specifying the HTTP method for sending the request \(`GET` or `POST`\) - `url`—parameter containing a link for redirection ```language-json "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" } } ``` ### Final callback format {#section_wsx_3jl_ggb .section} The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see [Handling callbacks](en_platform_callbacks.md#). The following is the example of a callback with information about a `1000.00 THB` purchase made by the `123` customer in the `382` project. ```language-json { "project_id": 382, "payment": { "type": "purchase", "sum": { "amount": 100000, "currency": "THB" }, "status": "success", "method": "promptpay", "id": "1234567", "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 with information about a declined purchase. ```language-json { "project_id": 383, "payment": { "type": "purchase", "sum": { "amount": 185384, "currency": "THB" }, "status": "decline", "method": "promptpay", "id": "1234567", "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 {#section_xsx_3jl_ggb .section} The following topics might be useful when implementing payments through Gate: - [Interaction concepts](en_gate_interaction_organisation.md#) - [Signature generation and verification](en_platform_signature.md#) - [Payment processing](en_platform_payment_model.md) - [Handling operation processing information](en_platform_payment_info_codes.md) ## Purchases by using Gate. Channel 2: without redirection of the customer {#en_pm_promptpay_app_gate_purchase} ### General information {#section_lsx_3jl_ggb .section} To process a purchase through Gate by using the Promptpay method, the merchant's web service is required to do the following: 1. Send a request with all the required parameters and signature to the Ecommpay URL. 2. Receive an intermediate callback from the payment platform and display the payment instructions to the customer. 3. Receive the final callback from the payment platform. The full sequence and special aspects of purchase processing are provided below. ![](images/pm/eng_promptpay_app_uml_gate.svg) 1. A customer initiates a purchase by using the Promptpay method in the web service. 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. 4. The payment platform validates the required parameters and signature in the request. 5. The payment platform sends the response to the web service with information about the receipt of the request and its validity \([details](en_gate_interaction_organisation.md#)\). 6. The payment platform performs the internal payment request processing. 7. The payment platform sends the callback with the payment instructions data to the web service. 8. The payment instructions are displayed to the customer. 9. The customer completes all required payment steps. 10. The purchase is processed in the provider service. 11. The provider service sends the payment result notification to the payment platform. 12. The payment platform sends the payment result callback to the web service. 13. The customer receives the payment result information from the web service. Information about the formats of requests and callbacks used for processing payments by using the Promptpay method via Gate is presented further in this section. General information about working with the Gate API is presented in [Interaction concepts](en_gate_interaction_organisation.md#). ### Request format {#section_osx_3jl_ggb .section} There are several things you need to consider when sending purchase requests by using the Promptpay method: 1. To initiate each purchase, send a separate POST request to the `/v2/payment/banks/promptpay/sale` endpoint. This endpoint belongs to the group [/v2/payment/banks/\{payment\_method\}/sale](https://api-developers.ecommpay.com/api-specification/banks/post-v2-payment-banks-payment-method-sale). 2. Each request must include the following objects and parameters: - Object `general`—general purchase information: - `project_id`—project identifierobtained from Ecommpay during integration - `payment_id`—payment identifierunique within the project - `signature`—request signaturegenerated after all required parameters are specified \(details—in the [Signature generation and verification](en_platform_signature.md#)\) - Object `payment`—payment information: - `amount`—payment amount in the smallest currency unit - `currency`—payment currency codein the ISO-4217 alpha-3 format - Object `customer`—customer information: - `id`—customer identifierunique within the project - `ip_address`—customer IP addressrelevant for the initiated payment 3. The currency of purchase can only be [THB](references/en/currencies/THB.md). 4. Additionally, any other parameters included in the specification can be used. Thus, a correct purchase request by using the Promptpay method must contain the project identifier, basic payment information \(identifier, amount, and currency code\), customer identifier and IP address, as well as signature. ```language-json { "general": { "project_id": 210, "payment_id": "0123456789", "signature": "PJkV8ej\/UG0Di8hTng6JvipTv+AWoXW\/9MTO8yJA==" }, "payment": { "amount": 1000, "currency": "THB" }, "customer": { "id": "customer123", "ip_address": "192.0.2.0" } } ``` ```language-json { "general": { "project_id": 210, "payment_id": "0123456789", "signature": "PJkV8ej\/UG0Di8hTng6JvipTv+AWoXW\/9MTO8yJA==" }, "payment": { "amount": 1000, "currency": "THB" }, "customer": { "id": "customer123", "ip_address": "192.0.2.0" } } ``` ### Formats of intermediate callbacks for displaying payment instructions {#section_g1g_n3f_45b .section} Each payment made with the Promptpay method requires displaying payment instructions to customers. To display payment instructions it is necessary to receive an intermediate callback from the payment platform and use the information included in the `display_data` array. The format of such callbacks is standard \([details](en_platform_callbacks.md#)\), and the following objects and parameters are included in the `display_data` array: - `type`—type of data \(the value is always `qr_img`\) - `title`—the name of the transferred data that needs to be displayed to the customer \(the value is always `QR code`\) - `data`—a string based on which a QR code should be generated on the web service side \(according to ISO 18004:2006\) ```language-json "display_data": [ { "type": "qr_img", "title": "QR code", "data": "0001101021230620016A000000677010112011505...764540510.005802TH6304XXXX" } ] ``` ### Final callback format {#section_wsx_3jl_ggb .section} The Promptpay method uses the standard format for callbacks to deliver purchase results. For more information, see [Handling callbacks](en_platform_callbacks.md#). The following is the example of a callback with information about a `1000.00 THB` purchase made by the `123` customer in the `456` project. ```language-json { "project_id": 456, "payment": { "id": "0123456789", "type": "purchase", "status": "success", "date": "2021-02-15T10:34:21+0000", "method": "promptpay", "sum": { "amount": 100000, "currency": "THB" }, "description": "" }, "customer": { "id": "123" }, "operation": { "id": 76, "type": "sale", "status": "success", "date": "2021-02-15T10:34:21+0000", "created_date": "2021-02-15T10:33:59+0000", "request_id": "a8ee115e2c7f2f9cd69a743f...c161bf1fcde0-00000001", "sum_initial": { "amount": 100000, "currency": "THB" }, "sum_converted": { "amount": 100000, "currency": "THB" }, "code": "0", "message": "Success", "provider": { "id": 4821, "payment_id": "0123456789", "auth_code": "", "date": "2021-02-15T10:34:13+0000" } }, "signature": "+II2IHZ3IjQcqVsIZ9oYb...atXOn2Czyo7L8g9NN1+WVtR+MGQ==" } } ``` The following is the example of a callback with information about a declined purchase. ```language-json { "project_id": 321, "payment": { "id": "0123456789", "type": "purchase", "status": "decline", "date": "2021-03-11T14:01:41+0000", "method": "promptpay", "sum": { "amount": 100000, "currency": "THB" }, "description": "" }, "operation": { "id": 123456789, "type": "sale", "status": "decline", "date": "2021-03-11T14:01:41+0000", "created_date": "2021-03-11T07:07:18+0000", "request_id": "09916aa29732a5e59890c409adaa1fd671...ca33-00088600", "sum_initial": { "amount": 100000, "currency": "THB" }, "sum_converted": { "amount": 100000, "currency": "THB" }, "code": "20000", "message": "General decline", "provider": { "id": 4821, "payment_id": "0123456789", "auth_code": "" } }, "signature": "Lk+5aUd6Hp3lR6ZRPXXA0vJ78tdwOrY80kTp...2f1ilyK1bkNrYw==" } } ``` ### Related topics {#section_xsx_3jl_ggb .section} The following topics might be useful when implementing payments through Gate: - [Interaction concepts](en_pp_interaction_organisation.md#) - [Signature generation and verification](en_platform_signature.md#) - [Payment processing](en_platform_payment_model.md) - [Handling operation processing information](en_platform_payment_info_codes.md) ## Analysis of payments results {#en_pm_promptpay_dash_analysis} To analyse information about payments made with the Promptpay method and other methods, you can use: - Dashboardinterface toolkitwith various lists and analytic panels. - Reports in CSV file format, available via the **Reports** section \(one-time and periodically\). - Data in JSON format, sent by program requests to a specified URL by using the Data API interface. If you have any questions, refer to the documentation \([Dashboard](en_dbl_about.md) and [Using Data API](en_dbl_api_protocol.md)\) and Ecommpay technical support.