Offer payment channels
Overview
A channel is a way for the customer to pay the same 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
Your key needs the payments:write scope, and you use your secret key, shown below as sk_test_YOUR_SECRET_KEY. Use a sandbox key while you build, because sandbox payments move no money. You need an invoice with an open intent, as created in the first step.
Steps
Create an invoice
Create the invoice as in the QR payments guide. 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.
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"}'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
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);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
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.
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"}'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
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);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
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 for each channel, so the NODE_QR code stays valid. Presenting a channel again replaces its earlier presentation.
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"}'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
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);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. |
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). 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.
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"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
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);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
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 for one request.
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"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
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);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))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.
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)"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
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);import json
import tappay
client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
intent = client.intents.cancel({"id": "INTENT_ID"})
print(json.dumps(intent))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
- Presenting a channel that is not in the
channelslist. TapPay rejects it with422, 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
409PAY-012, because the intent is no longer open. - Hiding the
deeplinkand showing only a code. The code can change, while thedeeplinkstays the same until the intent ends. - Expecting the deeplink to work for ever. The intent expires after the time set for the terminal, and the invoice expires too.
- Cancelling an intent whose payment is authorized and waits for capture. TapPay returns
409PRE-015.
Next steps
Confirm payments with the QR payments guide and listen for them with the webhooks guide. Break an order into lines with the orders guide. See every field in Present a payment intent, Retrieve a payment intent and Cancel a payment intent.