# Offer payment channels

> Show one payment intent on several channels, such as QR, QPay, card and request to pay, and manage it.

Source: https://docs.tappay.mn/guides/channels/

## Overview {#overview}

A [channel](https://docs.tappay.mn/glossary.md#channel) is a way for the [customer](https://docs.tappay.mn/glossary.md#customer) to pay the same [payment intent](https://docs.tappay.mn/glossary.md#payment-intent). You show the intent on one or more channels with the `present` operation. This guide shows each channel and what TapPay returns.

## Before you begin {#before-you-begin}

Your key needs the `payments:write` [scope](https://docs.tappay.mn/glossary.md#scope), and you use your [secret key](https://docs.tappay.mn/glossary.md#secret-key), shown below as `sk_test_YOUR_SECRET_KEY`. Use a [sandbox](https://docs.tappay.mn/glossary.md#sandbox) key while you build, because sandbox [payments](https://docs.tappay.mn/glossary.md#payment) move no money. You need an [invoice](https://docs.tappay.mn/glossary.md#invoice) with an open intent, as created in the first step.

## Steps {#steps}

### Create an invoice {#create-an-invoice}

Create the invoice as in the [QR payments guide](https://docs.tappay.mn/guides/qr-payments.md). The response has the `intentId` and a `channels` list, which holds the channels that this intent can use. That list is the channels enabled for your merchant, limited to the `allowedChannels` of the invoice and to what the intent needs.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/invoices" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d '{"terminalId":"YOUR_TERMINAL_ID","amount":1000,"description":"Order 1","orderId":"order-'"$(uuidgen)"'","returnUrl":"https://example.com/return"}'
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const invoice = await tappay.invoices.create({
  body: {
    terminalId: 'YOUR_TERMINAL_ID',
    amount: 1000,
    description: 'Order 1',
    orderId: `order-${crypto.randomUUID()}`,
    returnUrl: 'https://example.com/return',
  },
});
console.log(JSON.stringify(invoice));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$invoice = $tappay->invoices->create([
    'body' => [
        'terminalId' => 'YOUR_TERMINAL_ID',
        'amount' => 1000,
        'description' => 'Order 1',
        'orderId' => 'order-' . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)) . '',
        'returnUrl' => 'https://example.com/return',
    ],
]);
echo json_encode($invoice);
```

```python title="Python"
import json
import uuid
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
invoice = client.invoices.create({
    "body": {
        "terminalId": "YOUR_TERMINAL_ID",
        "amount": 1000,
        "description": "Order 1",
        "orderId": "order-" + str(uuid.uuid4()) + "",
        "returnUrl": "https://example.com/return",
    },
})
print(json.dumps(invoice))
```

### Show the intent as a QR code {#show-the-intent-as-a-qr-code}

Present the intent with the `channel` that you choose. The `NODE_QR` channel returns a `qrText` for a TapPay QR code. Every response also has an `expiresAt` time and a `status` of `ACTIVE`.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/intents/INTENT_ID/present" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d '{"channel":"NODE_QR"}'
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const intent = await tappay.intents.present({ id: 'INTENT_ID', body: { channel: 'NODE_QR' } });
console.log(JSON.stringify(intent));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$intent = $tappay->intents->present(['id' => 'INTENT_ID', 'body' => ['channel' => 'NODE_QR']]);
echo json_encode($intent);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
intent = client.intents.present({"id": "INTENT_ID", "body": {"channel": "NODE_QR"}})
print(json.dumps(intent))
```

### Show the intent on another channel {#show-the-intent-on-another-channel}

Present the same intent on `QPAY`. The response has a `qrText` for the QPay QR code, and `urls` with links that open bank apps. An intent keeps one `ACTIVE` [presentation](https://docs.tappay.mn/glossary.md#presentation) for each channel, so the `NODE_QR` code stays valid. Presenting a channel again replaces its earlier presentation.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/intents/INTENT_ID/present" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d '{"channel":"QPAY"}'
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const intent = await tappay.intents.present({ id: 'INTENT_ID', body: { channel: 'QPAY' } });
console.log(JSON.stringify(intent));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$intent = $tappay->intents->present(['id' => 'INTENT_ID', 'body' => ['channel' => 'QPAY']]);
echo json_encode($intent);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
intent = client.intents.present({"id": "INTENT_ID", "body": {"channel": "QPAY"}})
print(json.dumps(intent))
```

The channels return different data.

| Channel | What you get |
| - | - |
| `NODE_QR` | A `qrText` for a TapPay QR code. No call to an outside provider is needed. |
| `QPAY` | A `qrText` for a QPay QR code and `urls` with bank app links. |
| `WECHAT` | A `qrText` that holds the WeChat `code_url`. It is not available in the sandbox. |
| `CARD` | A `urls` object with a `payment` link to a hosted card page. You never see the card acquirer. |
| `R2P` | A request to pay in the wallet of the customer. It needs an invoice `customer` with an active [payer link](https://docs.tappay.mn/glossary.md#payer-link). |

### Read the intent {#read-the-intent}

Read the intent to see its `status` and its `presentations`. Use `expand=walletLinks` to also get links that open wallet apps ([show them in your app](https://docs.tappay.mn/guides/mobile-app.md#create-an-invoice-with-wallet-links)). The `deeplink` stays the same while the QR code changes, so give customers the `deeplink` and not a code. After the payment the wallet returns to the TapPay page by `https://pay.tappay.mn/q/{ref}?from=wallet`, and the page sends the customer on to the invoice's `returnUrl` or `cancelUrl` — [Return addresses](https://docs.tappay.mn/guides/checkout.md#return-urls).

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/intents/INTENT_ID" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const intent = await tappay.intents.retrieve({ id: 'INTENT_ID' });
console.log(JSON.stringify(intent));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$intent = $tappay->intents->retrieve(['id' => 'INTENT_ID']);
echo json_encode($intent);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
intent = client.intents.retrieve({"id": "INTENT_ID"})
print(json.dumps(intent))
```

### Check requests to pay {#check-requests-to-pay}

After you present the `R2P` channel, list the requests to pay that TapPay sent for the intent. Each request has a `status` of `SENT`, `PAID`, `DECLINED`, `EXPIRED` or `CANCELLED`. A declined request has a `declineReason`. Use [Retrieve a request to pay](https://docs.tappay.mn/reference/r2p-requests/get.md) for one request.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/intents/INTENT_ID/r2p-requests" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const r2pRequest = await tappay.r2pRequests.list({ id: 'INTENT_ID' });
console.log(JSON.stringify(r2pRequest));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$r2pRequest = $tappay->r2pRequests->list(['id' => 'INTENT_ID']);
echo json_encode($r2pRequest);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
r2p_request = client.r2p_requests.list({"id": "INTENT_ID"})
print(json.dumps(r2p_request))
```

> **Note:** **R2P in the sandbox**
>
> The sandbox has no [simulator](https://docs.tappay.mn/glossary.md#simulator) for the wallet of the customer, so `R2P` requests are not paid there. The call above returns an empty list. Test the rest of your flow with the `NODE_QR` and `QPAY` channels.

### Cancel the intent {#cancel-the-intent}

Cancel an open intent when the customer changes their mind. Its presentations close, and the customer can no longer pay it. Other intents of the same invoice are not changed.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/intents/INTENT_ID/cancel" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const intent = await tappay.intents.cancel({ id: 'INTENT_ID' });
console.log(JSON.stringify(intent));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$intent = $tappay->intents->cancel(['id' => 'INTENT_ID']);
echo json_encode($intent);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
intent = client.intents.cancel({"id": "INTENT_ID"})
print(json.dumps(intent))
```

## Verify {#verify}

The intent `status` is `CANCELLED` after the call above, and `OPEN` while the customer can still pay. When a payment succeeds, TapPay sends `payment.succeeded`, and the intent `status` becomes `SUCCEEDED`. Read the intent with the request in the read step.

## Common mistakes {#common-mistakes}

- Presenting a channel that is not in the `channels` list. TapPay rejects it with `422`, because the channel is not enabled, not allowed on the invoice or not supported by the intent.
- Expecting one presentation to cover every channel. Each channel has its own, and presenting a channel again closes its earlier one.
- Presenting an intent that has expired or was cancelled. TapPay returns `409` [PAY-012](https://docs.tappay.mn/errors.md#PAY-012), because the intent is no longer open.
- Hiding the `deeplink` and showing only a code. The code can change, while the `deeplink` stays the same until the intent ends.
- Expecting the [deeplink](https://docs.tappay.mn/glossary.md#deeplink) to work for ever. The intent expires after the time set for the [terminal](https://docs.tappay.mn/glossary.md#terminal), and the invoice expires too.
- Cancelling an intent whose payment is authorized and waits for capture. TapPay returns `409` [PRE-015](https://docs.tappay.mn/errors.md#PRE-015).

## Next steps {#next-steps}

Confirm payments with the [QR payments guide](https://docs.tappay.mn/guides/qr-payments.md) and listen for them with the [webhooks guide](https://docs.tappay.mn/guides/webhooks.md). Break an order into lines with the [orders guide](https://docs.tappay.mn/guides/orders.md). See every field in [Present a payment intent](https://docs.tappay.mn/reference/intents/present.md), [Retrieve a payment intent](https://docs.tappay.mn/reference/intents/get.md) and [Cancel a payment intent](https://docs.tappay.mn/reference/intents/cancel.md).
