# Present an embedded session

> Used by the TapPay checkout script when the customer picks a payment channel.

Source: https://docs.tappay.mn/reference/embedded-sessions/present/

Used by the TapPay checkout script when the [customer](https://docs.tappay.mn/glossary.md#customer) picks a [payment](https://docs.tappay.mn/glossary.md#payment) [channel](https://docs.tappay.mn/glossary.md#channel). It returns what the customer needs to pay and records the customer's consent.

`POST /api/checkout/embedded/sessions/{id}/present`

### Authentication

Publishable key + X-Client-Secret

### Headers

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `X-Client-Secret` | string | yes | | |
| `Idempotency-Key` | string | yes | | |

### Path parameters

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `id` | string (uuid) | yes | | |

### Request body

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `channel` | string | yes | `QPAY`, `NODE_QR`, `WECHAT`, `CARD`, `R2P` | |
| `consent` | boolean | no | | |

### Response 201

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `success` | boolean | yes | `true` | |
| `data` | object | yes | | |
| `data.kind` | string | yes | `CARD`, `PRESENTATION` | |
| `data.attemptToken` | string | no | | |
| `data.presentation` | object | no | | |
| `data.presentation.channel` | string | yes | `QPAY`, `NODE_QR`, `WECHAT`, `CARD`, `R2P` | |
| `data.presentation.display` | string | yes | `CARD_FORM`, `QR`, `WALLET_REQUEST` | |
| `data.presentation.qrText` | string \| null | yes | | |
| `data.presentation.links` | array\<object> | yes | | |
| `data.presentation.links[].label` | string | yes | | |
| `data.presentation.links[].logoUrl` | string \| null | yes | | |
| `data.presentation.links[].url` | string | yes | | |
| `data.presentation.expiresAt` | string | yes | | |

### Errors

| Code | Status | Message |
| - | - | - |
| [`VAL-002`](https://docs.tappay.mn/errors.md#VAL-002) | 400 | A required field or header is missing. |
| [`VAL-010`](https://docs.tappay.mn/errors.md#VAL-010) | 409 | This Idempotency-Key was already used with a different request body. |
| [`VAL-013`](https://docs.tappay.mn/errors.md#VAL-013) | 409 | A request with this Idempotency-Key is still being processed. |
| [`VAL-014`](https://docs.tappay.mn/errors.md#VAL-014) | 400 | The TapPay-Version header is not a known API version. |
| [`AUTH-001`](https://docs.tappay.mn/errors.md#AUTH-001) | 401 | The API key is missing, invalid or revoked. |
| [`AUTH-058`](https://docs.tappay.mn/errors.md#AUTH-058) | 403 | The API key does not have the scope this operation requires. |
| [`PAY-001`](https://docs.tappay.mn/errors.md#PAY-001) | 404 | The invoice was not found. |
| [`PAY-010`](https://docs.tappay.mn/errors.md#PAY-010) | 422 | The requested payment channel is not available for this payment. |
| [`PAY-012`](https://docs.tappay.mn/errors.md#PAY-012) | 409 | The payment intent is no longer open. |
| [`PAY-033`](https://docs.tappay.mn/errors.md#PAY-033) | 409 | The checkout session is not open. |
| [`PAY-034`](https://docs.tappay.mn/errors.md#PAY-034) | 404 | The checkout session was not found, or the client secret does not match. |
| [`PAY-035`](https://docs.tappay.mn/errors.md#PAY-035) | 422 | The payer's consent is required for this payment. |
| [`BIZ-004`](https://docs.tappay.mn/errors.md#BIZ-004) | 403 | The terminal is not active. |
| [`BIZ-005`](https://docs.tappay.mn/errors.md#BIZ-005) | 403 | The merchant account is not in a state that allows this request. |
| [`AFP-003`](https://docs.tappay.mn/errors.md#AFP-003) | 410 | The payment intent has expired. |
| [`PSP-003`](https://docs.tappay.mn/errors.md#PSP-003) | 422 | The provider terminal required for this payment is not configured. |

Try it in the playground: https://docs.tappay.mn/reference/embedded-sessions/present/

*The SDKs do not cover this API (browser checkout script) — the example calls HTTP directly.*

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID/present" \
  -H "Authorization: Bearer pk_test_YOUR_PUBLISHABLE_KEY" \
  -H "X-Client-Secret: CLIENT_SECRET" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d '{"channel":"CARD","consent":true}'
```

```js title="Node.js"
const res = await fetch('https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID/present', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer pk_test_YOUR_PUBLISHABLE_KEY',
    'X-Client-Secret': 'CLIENT_SECRET',
    'TapPay-Version': '2026-09-27',
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    channel: 'CARD',
    consent: true,
  }),
});
console.log(await res.text());
```

```php title="PHP"
<?php
$body = json_encode([
    'channel' => 'CARD',
    'consent' => true,
]);
$ch = curl_init('https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID/present');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer pk_test_YOUR_PUBLISHABLE_KEY',
        'X-Client-Secret: CLIENT_SECRET',
        'TapPay-Version: 2026-09-27',
        'Idempotency-Key: ' . bin2hex(random_bytes(16)),
        'Content-Type: application/json',
    ],
]);
echo curl_exec($ch);
```

```python title="Python"
import json, urllib.request, uuid

req = urllib.request.Request(
    'https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID/present',
    data=json.dumps({
        'channel': 'CARD',
        'consent': True,
    }).encode(),
    method='POST',
    headers={
        'Authorization': 'Bearer pk_test_YOUR_PUBLISHABLE_KEY',
        'X-Client-Secret': 'CLIENT_SECRET',
        'TapPay-Version': '2026-09-27',
        'Idempotency-Key': str(uuid.uuid4()),
        'Content-Type': 'application/json',
    },
)
print(urllib.request.urlopen(req).read().decode())
```

```json title="Response"
{
  "success": true,
  "data": {
    "kind": "CARD",
    "attemptToken": "att_7f3a91c2d4e8"
  }
}
```

> **Note:** **Two kinds of answer**
>
> The `CARD` channel returns `kind` `CARD` with an `attemptToken` for the card form. Other channels return `kind` `PRESENTATION` with a QR or links.

> **Warning:** **Publishable key only**
>
> This call is made by the page of the customer. It needs your [publishable key](https://docs.tappay.mn/glossary.md#publishable-key) and the `clientSecret`. A [secret key](https://docs.tappay.mn/glossary.md#secret-key) is refused with `AUTH-058`.

For the full flow, read the [guide](https://docs.tappay.mn/guides/checkout.md).
