---
title: "PromptPay iOS Component"
description: "Add PromptPay to your existing iOS Components integration."
url: "https://docs.adyen.com/payment-methods/promptpay/ios-component"
source_url: "https://docs.adyen.com/payment-methods/promptpay/ios-component.md"
canonical: "https://docs.adyen.com/payment-methods/promptpay/ios-component"
last_modified: "2026-05-26T13:48:55+02:00"
language: "en"
---
# PromptPay iOS Component
Add PromptPay to your existing iOS Components integration.
[View source](/payment-methods/promptpay/ios-component.md)
Our PromptPay Component renders PromptPay in your payment form and collects your shopper's selected bank.
## Requirements
Select the [server-side flow](/online-payments/build-your-integration) that your integration uses:
### Tab: Sessions flow
| Requirement | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | Make sure that you have built a Sessions flow [iOS Components integration](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components). |
| **Setup steps** | Before you begin, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add PromptPay in your Customer Area. |
### Tab: Advanced flow
| Requirement | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Integration type** | Make sure that you have built an Advanced flow [iOS Components integration](/online-payments/build-your-integration/advanced-flow?platform=iOS\&integration=Components). |
| **Setup steps** | Before you begin, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add PromptPay in your Customer Area. |
## Show PromptPay in your payment form
Include PromptPay in the list of available payment methods.
1. Specify in your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request:
* [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode): **TH**.
* [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency): **THB**.
* [channel](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-channel): Specify **iOS**.
2. Decode the `/paymentMethods` response with the `PaymentMethods` structure.
```swift
let paymentMethods = try JSONDecoder().decode(PaymentMethods.self, from: paymentMethodsResponse)
```
Find `paymentMethods.type` ****promptpay**** and put it into an object. For example, `promptpayPaymentMethod`.
3. Create an instance of `APIContext` with the following parameters:
| Parameter name | Required | Description |
| -------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientKey` |  | Your [client key](/development-resources/client-side-authentication). |
| `environment` |  | Use **test**. When you are ready to accept live payments, change the value to one of our [live environments](https://adyen.github.io/adyen-ios/5.0.0/documentation/adyen/environment/). |
**APIContext initialization**
```swift
// When you are ready to go live, change environment to Environment.live
// You can also use other environment values described in https://adyen.github.io/adyen-ios/Docs/Structs/Environment.html
let apiContext = APIContext(environment: Environment.test, clientKey: clientKey)
```
4. Initialize the PromptPay Component:
```swift
let promptpayComponent = PromptPayComponent(paymentMethod: promptpayPaymentMethod, apiContext: apiContext)
promptpayComponent.delegate = self
// In this example, the Pay button will show 10 THB.
// The value is in minor units. Change the currencyCode to the currency for the PromptPay Component.
promptpayComponent.payment = Payment(amount: Amount(value: 1000,
currencyCode: "THB"))
present(promptpayComponent.viewController, animated: true)
```
## Make a payment
When the shopper proceeds to pay, the Component invokes the `didSubmit` method containing the `data.paymentMethod` from the `PaymentComponentDelegate`.
1. Pass the `data.paymentMethod` to your server.
2. From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying:
* `paymentMethod.type`: The `data.paymentMethod` from your client app.
#### curl
```bash
curl https://checkout-test.adyen.com/v72/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"amount": {
"currency": "THB",
"value": 10000
},
"paymentMethod": {
"type": "promptpay"
},
"reference": "YOUR_ORDER_NUMBER"
}'
```
#### Java
```java
// Adyen Java API Library v39.3.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.checkout.*;
import java.time.OffsetDateTime;
import java.util.*;
import com.adyen.model.RequestOptions;
import com.adyen.service.checkout.*;
// For the LIVE environment, also include your liveEndpointUrlPrefix.
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Create the request object(s)
// Send the request
PaymentsApi service = new PaymentsApi(client);
PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
```
#### PHP
```php
setXApiKey("ADYEN_API_KEY");
// For the LIVE environment, also include your liveEndpointUrlPrefix.
$client->setEnvironment(Environment::TEST);
// Create the request object(s)
$requestOptions['idempotencyKey'] = 'UUID';
// Send the request
$service = new PaymentsApi($client);
$response = $service->payments($paymentRequest, $requestOptions);
```
#### C\#
```cs
// Adyen .net API Library v32.1.1
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
// For the LIVE environment, also include your liveEndpointUrlPrefix.
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Create the request object(s)
// Send the request
var service = new PaymentsService(client);
var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
```
#### NodeJS (JavaScript)
```js
// Adyen Node API Library v29.0.0
const { Client, CheckoutAPI } = require('@adyen/api-library');
// For the LIVE environment, also include your liveEndpointUrlPrefix.
const config = new Config({
apiKey: "ADYEN_API_KEY",
environment: EnvironmentEnum.TEST
});
const client = new Client(config);
// Create the request object(s)
const paymentRequest = {
merchantAccount: "YOUR_MERCHANT_ACCOUNT",
amount: {
currency: "THB",
value: 10000
},
paymentMethod: {
type: "promptpay"
},
reference: "YOUR_ORDER_NUMBER"
}
// Send the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
```
#### Go
```go
// Adyen Go API Library v21.0.0
import (
"context"
"github.com/adyen/adyen-go-api-library/v21/src/common"
"github.com/adyen/adyen-go-api-library/v21/src/adyen"
"github.com/adyen/adyen-go-api-library/v21/src/checkout"
)
// For the LIVE environment, also include your liveEndpointUrlPrefix.
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Create the request object(s)
// Send the request
service := client.Checkout()
req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
```
#### Python
```py
# Adyen Python API Library v13.6.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
# For the LIVE environment, also include your liveEndpointUrlPrefix.
adyen.client.platform = "test" # The environment to use library in.
# Create the request object(s)
json_request = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"amount": {
"currency": "THB",
"value": 10000
},
"paymentMethod": {
"type": "promptpay"
},
"reference": "YOUR_ORDER_NUMBER"
}
# Send the request
result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
```
#### Ruby
```rb
# Adyen Ruby API Library v10.4.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
# For the LIVE environment, also include your liveEndpointUrlPrefix.
adyen.env = :test # Set to "live" for live environment
# Create the request object(s)
request_body = {
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:amount => {
:currency => 'THB',
:value => 10000
},
:paymentMethod => {
:type => 'promptpay'
},
:reference => 'YOUR_ORDER_NUMBER'
}
# Send the request
result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
```
#### NodeJS (TypeScript)
```ts
// Adyen Node API Library v29.0.0
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// For the LIVE environment, also include your liveEndpointUrlPrefix.
const config = new Config({
apiKey: "ADYEN_API_KEY",
environment: EnvironmentEnum.TEST
});
const client = new Client(config);
// Create the request object(s)
// Send the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
```
The response contains the following data:
* `resultCode`: **Pending**
* `action`: Contains the QR code `url` and `qrCodeData`.
**/payments response**
```json
{
"pspReference": "8815658961765250",
"resultCode": "Pending",
"action": {
"paymentData": "Ab02b4c0!BQABAgA...",
"paymentMethodType": "promptpay",
"type": "qrCode",
"url": "https://test.adyen.com/hpp/generateQRCodeImage.shtml?url=DMhpN90TFR2e7TzwHYRFkhw4brxm2wHBg",
"qrCodeData": "DMhpN90TFR2e7TzwHYRFkhw4brxm2wHBg"
}
}
```
## Show the QR code
Use the information in the `action` object of the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response to render the QR code.
* `action.url`: Use this URL to download the QR code.
* `action.qrCodeData`: Use this to render the QR code on your checkout page.
The shopper can either scan the QR code, or take a screenshot of the QR code and upload it to their bank app.
## Show the payment result
Use the `resultCode` from the [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) response to show the payment outcome on your frontend.
You will also receive the outcome of the payment asynchronously in a [webhook](/development-resources/webhooks).
The `resultCode` values you can receive for PromptPay are:
| eventCode | success field | Description | Action to take |
| ----------------- | ------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------- |
| **AUTHORISATION** | **false** | The transaction failed. | Cancel the order and inform the shopper that the payment failed. |
| **AUTHORISATION** | **true** | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. |
## Test and go live
Test PromptPay payments with real payment details and small amounts.
Check the status of your test PromptPay payments in your **Customer Area** > **Transactions** > **Payments**.
To accept live PromptPay payments, you must contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add PromptPay in your live Customer Area.
## See also
* [iOS Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components)
* [Webhooks](/development-resources/webhooks)
* [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)