# Retrieve an embedded session

> Used by the TapPay checkout script to load the session that you mounted in your page.

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

Used by the TapPay checkout script to load the session that you mounted in your page. It needs your [publishable key](https://docs.tappay.mn/glossary.md#publishable-key) and the session's `X-Client-Secret` header.

`GET /api/checkout/embedded/sessions/{id}`

### Authentication

Publishable key + X-Client-Secret

### Headers

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

### Path parameters

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

### Response 200

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `success` | boolean | yes | `true` | |
| `data` | object | yes | | |
| `data.id` | string | yes | | |
| `data.mode` | string | yes | `PAYMENT`, `SETUP`, `SUBSCRIPTION` | |
| `data.uiMode` | string | yes | `HOSTED`, `EMBEDDED` | |
| `data.status` | string | yes | `OPEN`, `COMPLETE`, `EXPIRED` | |
| `data.merchant` | object | yes | | |
| `data.merchant.name` | string | yes | | |
| `data.merchant.logoUrl` | string \| null | no | | |
| `data.merchant.reviewUrl` | string \| null | no | | |
| `data.amount` | number | yes | | |
| `data.serviceFee` | number \| null | yes | | |
| `data.total` | number | yes | | |
| `data.currency` | string | yes | | |
| `data.description` | string \| null | yes | | |
| `data.lines` | array\<object> | yes | | |
| `data.lines[].name` | string | yes | | |
| `data.lines[].quantity` | string | yes | | |
| `data.lines[].unitPrice` | number | yes | | |
| `data.lines[].total` | number | yes | | |
| `data.channels` | array\<string> | yes | | |
| `data.shortDeeplink` | string | yes | | |
| `data.presentations` | array\<object> | yes | | |
| `data.presentations[].channel` | string | yes | `QPAY`, `NODE_QR`, `WECHAT`, `CARD`, `R2P` | |
| `data.presentations[].display` | string | yes | `CARD_FORM`, `QR`, `WALLET_REQUEST` | |
| `data.presentations[].qrText` | string \| null | yes | | |
| `data.presentations[].links` | array\<object> | yes | | |
| `data.presentations[].links[].label` | string | yes | | |
| `data.presentations[].links[].logoUrl` | string \| null | yes | | |
| `data.presentations[].links[].url` | string | yes | | |
| `data.presentations[].expiresAt` | string | yes | | |
| `data.wallets` | array\<object> | yes | | |
| `data.wallets[].partnerId` | string | yes | | |
| `data.wallets[].appName` | string | yes | | |
| `data.wallets[].logoUrl` | string \| null | yes | | |
| `data.wallets[].deeplink` | string | yes | | |
| `data.expiresAt` | string | yes | | |
| `data.cancelUrl` | string \| null | no | | |
| `data.usage` | string | no | `UNSCHEDULED`, `RECURRING` | |
| `data.result` | object | no | | |
| `data.result.status` | string | yes | `SUCCEEDED`, `PROCESSING`, `FAILED` | |
| `data.result.channel` | string \| null | yes | `QPAY`, `NODE_QR`, `WECHAT`, `CARD`, `R2P`, `null` | |
| `data.result.paymentId` | string | no | | |
| `data.result.maskedPan` | string | no | | |
| `data.result.cardBrand` | string | no | | |
| `data.redirectUrl` | string \| null | no | | |
| `data.preauth` | object \| null | no | | |
| `data.preauth.amount` | number | yes | | |
| `data.preauth.finalizeDueDate` | string | yes | | |
| `data.subscription` | object \| null | no | | |
| `data.subscription.purpose` | string | yes | `START`, `CARD_UPDATE` | |
| `data.subscription.planName` | string | yes | | |
| `data.subscription.amount` | number | yes | | |
| `data.subscription.currency` | string | yes | | |
| `data.subscription.interval` | string | yes | `DAY`, `WEEK`, `MONTH`, `YEAR` | |
| `data.subscription.intervalCount` | integer | yes | | |
| `data.subscription.trialDays` | integer | yes | | |

### Errors

| Code | Status | Message |
| - | - | - |
| [`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-034`](https://docs.tappay.mn/errors.md#PAY-034) | 404 | The checkout session was not found, or the client secret does not match. |
| [`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. |
| [`SET-002`](https://docs.tappay.mn/errors.md#SET-002) | 400 | A required platform setting is missing or unknown. |
| [`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/get/

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

```bash title="curl"
curl -sS "https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID" \
  -H "Authorization: Bearer pk_test_YOUR_PUBLISHABLE_KEY" \
  -H "X-Client-Secret: CLIENT_SECRET" \
  -H "TapPay-Version: 2026-09-27"
```

```js title="Node.js"
const res = await fetch('https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer pk_test_YOUR_PUBLISHABLE_KEY',
    'X-Client-Secret': 'CLIENT_SECRET',
    'TapPay-Version': '2026-09-27',
  },
});
console.log(await res.text());
```

```php title="PHP"
<?php
$ch = curl_init('https://api.tappay.mn/api/checkout/embedded/sessions/SESSION_ID');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer pk_test_YOUR_PUBLISHABLE_KEY',
        'X-Client-Secret: CLIENT_SECRET',
        'TapPay-Version: 2026-09-27',
    ],
]);
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',
    method='GET',
    headers={
        'Authorization': 'Bearer pk_test_YOUR_PUBLISHABLE_KEY',
        'X-Client-Secret': 'CLIENT_SECRET',
        'TapPay-Version': '2026-09-27',
    },
)
print(urllib.request.urlopen(req).read().decode())
```

```json title="Response"
{
  "success": true,
  "data": {
    "id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e01",
    "mode": "PAYMENT",
    "uiMode": "EMBEDDED",
    "status": "OPEN",
    "merchant": {
      "name": "Demo Shop LLC",
      "logoUrl": null
    },
    "amount": 1000,
    "serviceFee": null,
    "total": 1000,
    "currency": "MNT",
    "description": "Order 1048",
    "lines": [],
    "channels": [
      "CARD"
    ],
    "environment": "SANDBOX",
    "shortDeeplink": "https://pay.tappay.mn/s/Ab3xK9",
    "presentations": [],
    "wallets": [],
    "expiresAt": "2026-10-03T08:45:00.000Z",
    "cancelUrl": "https://example.com/cancel",
    "usage": "RECURRING",
    "preauth": {
      "amount": 1000,
      "finalizeDueDate": "2026-10-10T08:15:00.000Z"
    }
  }
}
```

> **Warning:** **Publishable key only**
>
> This call is made by the page of the [customer](https://docs.tappay.mn/glossary.md#customer). It needs your 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).
