# PromptPay

> Accept one-time PromptPay payments through the Direct API, Checkout, or the Web SDK, and confirm the result on your server.

## Basic information

Customers use a banking app that supports PromptPay to scan a payment QR code.

- Integration paths: [Direct API](/payments/versions/v2/online-payments/api), [Checkout](/payments/versions/v2/online-payments/checkout), [Web SDK](/payments/versions/v2/online-payments/sdk)
- Transaction type: One-time payment
- `lpmsInfo.lpmsType`: `PromptPay`
- Web SDK `config.paymentMethod`: `['PromptPay']`

| Customer country/region | Order currency |
| --- | --- |
| 🇹🇭 TH | THB |

The customer country/region is the `billingInformation.country` value in the payment request.

This guide covers enabled configurations. The Direct API flow requires customer details supplied in advance. After you create a payment, Checkout or the Web SDK displays the methods available for that order, and the customer selects PromptPay.

Before integrating another market or using another order currency, confirm the enabled scope for your merchant account and application with Onerway, then use [List available payment methods](/payments/versions/v2/api-reference/endpoints/list-available-payment-methods) to check the current order.

## Before you begin

Complete [Setup](/payments/versions/v2/get-started/setup) and confirm with Onerway that PromptPay is enabled for your merchant and application. Also confirm the applicable transaction limits, payment validity period, and settlement arrangements. For amount formatting, see [Currency and amount validation](/payments/versions/v2/get-started/currency-and-amount).

Configure your server notification URL and customer return URL, and store the mapping between your order and `paymentId`. If the flow redirects the customer, use the return page to restore the order view.

## Start the payment

### Direct API

For this Direct API flow, collect the customer details before creating the payment and supply `firstName`, `lastName`, `email`, `country`, `phoneCountryCode`, and `phone` in [`billingInformation`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-billingInformation). Use the customer’s actual billing country and follow the API conditions for shipping information and any other fields.

Use a local phone number without its country code in `phone`, and the corresponding dialing code as digits without `+` in `phoneCountryCode`.

1. Check [List available payment methods](/payments/versions/v2/api-reference/endpoints/list-available-payment-methods) for the current order. After the customer selects PromptPay, call [Create direct transaction](/payments/versions/v2/api-reference/endpoints/direct-create-transaction) from your server with `productType=LPMS`, `subProductType=DIRECT`, `txnType=SALE`, and `paymentMode=WEB`. Set `lpmsType=PromptPay` in [`lpmsInfo`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-lpmsInfo), encoded as a JSON string.
2. Supply the customer details listed above in `billingInformation`, and follow the API requirements for `shippingInformation`. Encode both as JSON strings. Include products, notification and return URLs, and merchant-collected end-user IP, browser, and device information in [`txnOrderMsg`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#request-txnOrderMsg). Keep product and order currencies consistent, with product amounts, discounts, and shipping fees adding up to `orderAmount`.<br />Select the request example “Redirect local payment request (illustrative)”. It uses Bancontact / BE / EUR to show the shared structure. Replace the method with `PromptPay`, use THB for this flow, and supply the actual order and the customer details required by this Direct flow. The example amount does not establish a transaction limit.
3. Store the returned `paymentId` and `transactionId`. When `status=R` and [`actionType=QrCode`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#response-data-actionType), display the payment QR code on your page using [`data.codeForm`](/payments/versions/v2/api-reference/endpoints/direct-create-transaction#response-data-codeForm). This is a JSON object, not a JSON string. Select a supported entry from `codeDetails`: for `codeValueType=QRCODE` and `displayType=TEXT`, generate a QR code from `codeValue`; for `codeValueType=QRCODE` and `displayType=IMAGE`, display the image at the returned `codeValue` URL. Do not assume a fixed number or order of entries. If `codeForm.expireTime` is returned, use it to determine when the code expires. The illustrative redirect response is not the QR-code response for this flow.
4. Ask the customer to scan the displayed code with a banking app that supports PromptPay, review the payment details, and confirm payment. For other actions or states, follow [Local payment integration](/payments/versions/v2/online-payments/payment-methods/local-payment-methods#handle-the-customer-action). Do not repeatedly create the same order while waiting; confirm the result on your server. See [Request authentication](/payments/versions/v2/get-started/authentication) for authentication.

### Checkout

1. On your server, call [Create checkout payment](/payments/versions/v2/api-reference/endpoints/create-checkout-payment) with `productType=ALL`, `subProductType=DIRECT`, and `txnType=SALE`. To show only PromptPay, set [`lpmsInfo.lpmsType`](/payments/versions/v2/api-reference/endpoints/create-checkout-payment#request-lpmsInfo) to `PromptPay`, sending `lpmsInfo` as a JSON string. If you omit `lpmsInfo`, the customer chooses from the methods available for the order.
2. Supply the billing, shipping, product, return URL, and notification URL fields required by the API. Encode `billingInformation` and `shippingInformation` as JSON strings, including the required email and country for each. Keep product and order currencies consistent and ensure that product amounts, discount entries, and shipping fees add up to `orderAmount`.<br />Select the request example “Unified Checkout with all available payment methods”, replace the order and customer details, and add this method's `lpmsInfo` if you want to select only this method. Use THB for this flow. Remove the example’s `cardInfo` object for this QR-payment flow.
3. Select the response example “Unified Checkout session created”. Store the returned `paymentId` and `transactionId` against your order, then redirect the customer's browser to `redirectUrl`. The initial `status=U` means that payment has not been completed.
4. Onerway Checkout handles the payment page and customer payment interaction. When the customer reaches `returnUrl`, retrieve the order result from your server. If no notification has arrived, use the stored transaction identifier to [Query transactions](/payments/versions/v2/api-reference/endpoints/query-transactions). For request authentication, redirects, and return handling, see [Checkout integration](/payments/versions/v2/online-payments/checkout).

### Web SDK

For this SDK path, keep the SDK billing address form (leave `config.showBillingAddress` at its default `true`) so the customer enters billing details as prompted. You can send billing information you already hold when creating or updating the order. For field formats and conditions, see [Create SDK transaction](/payments/versions/v2/api-reference/endpoints/sdk-create-transaction#request-billingInformation).

1. On your server, call [Create SDK transaction](/payments/versions/v2/api-reference/endpoints/sdk-create-transaction) with `productType=ALL`, `subProductType=DIRECT`, and `txnType=SALE`. Select the request example “One-time SDK payment” and the response example “One-time SDK transaction created”. These examples show the shared creation flow before a payment method is selected. Replace the amount, currency, and product details with the actual order, keeping the product and order currencies consistent.
2. Initialize Checkout with the returned `paymentId`, following [Web SDK integration](/payments/versions/v2/online-payments/sdk). To display only this method, set `config.paymentMethod` to `['PromptPay']` in the initialization options. Then subscribe to events and mount the Payment Element. This configuration only filters methods returned by the server; it does not enable PromptPay.
3. In the `ready` event, check that `availablePaymentMethods` contains `PromptPay`.
4. After the customer selects PromptPay and completes the form, call `confirmPayment()` from your payment button. Handle the actual `paymentStatus` and `nextAction` returned. For the complete event and error handling flow, see [Web SDK integration](/payments/versions/v2/online-payments/sdk).

With the Web SDK, `paymentStatus=R` means that customer interaction must continue. Handle the actual `nextAction.type` returned:

- `PresentToShopper`: keep the current SDK Checkout instance and leave its Payment Element mounted while the SDK presents the payment interface, wait for `payment_result`, and do not call `confirmPayment()` again.
- `RedirectShopper`: wait for the customer to reach the `returnUrl` supplied when creating the order, then query the order on your server. Initially show that the result is being confirmed.

## Customer actions and final result

Customers open a banking app that supports PromptPay, scan the code on the payment page, review the amount and recipient, and follow the app instructions to confirm. For the Direct API, your application displays the code as described above. With Checkout or the Web SDK, Onerway handles the code display. For this flow, customers need a device displaying the code and a phone with the banking app.

Keep the payment page available while the customer completes payment. If the page reports that the code has expired, or the customer closes it before finishing, query the original order before deciding what to do next. A displayed code, a scan, or a closed page alone does not determine the final order status.

Process the order on your server using a signature-verified [payment result webhook](/payments/versions/v2/api-reference/webhooks/payment-result). If the notification has not arrived or you need to check the result, call [Query payments](/payments/versions/v2/api-reference/endpoints/query-payments) with the stored `paymentId`. Fulfill the order only after your server confirms a successful payment. For verification, acknowledgement, idempotency, and query fallback, see [Webhooks](/payments/versions/v2/get-started/webhooks).

Closing the payment page or returning to your site does not establish a successful payment. Restore page interaction after a cancellation and continue to use the server result for the order status. Do not fulfill an order or update your ledger based on status parameters in the return URL.

## Refunds and disputes

Before integration, confirm the refund capabilities, restrictions, and dispute process applicable to your merchant with Onerway. If refunds are enabled, follow [Refunds](/payments/versions/v2/online-payments/scenarios/refunds).

## Testing and go-live

Confirm the test environment and available PromptPay test options with Onerway, then follow [Sandbox testing](/payments/versions/v2/get-started/testing):

1. Test each path you use with THB and the customer details required for that path. For the Direct API, verify the QR-code representations your integration supports from the actual `codeDetails`, and handle `codeForm.expireTime` when provided. For Checkout, confirm that the first `redirectUrl` opens Checkout and that `PromptPay` is available. For the Web SDK, check that `ready.availablePaymentMethods` contains `PromptPay`.
2. Confirm that the QR code is displayed correctly for your chosen integration path. Follow the test procedure agreed with Onerway to verify the payment result, then confirm it on your server before updating the order. Before testing a real scan, confirm the applicable environment and banking app with Onerway. For go-live acceptance, retain the notification and acknowledgement for the same order, then make an active query to verify that the results agree.
3. Cancel or close the payment page partway through the flow. Confirm that a return to your site alone never marks the order as paid, and test query fallback when no notification has arrived.
4. Verify idempotent handling of duplicate notifications. Before going live, check production enablement, notification and return URLs, limits, and validity periods. Test refunds separately if they are enabled.
