# Push a payment to a bank POS terminal

> Send an amount from your till to a bank card terminal and follow the result by webhook or by reading the payment.

Source: https://docs.tappay.mn/guides/terminal-payments/

## Overview {#overview}

A bank POS [terminal](https://docs.tappay.mn/glossary.md#terminal) is a card machine of your bank. You link it to a [payment](https://docs.tappay.mn/glossary.md#payment) point in the portal. Your till sends an amount and the [customer](https://docs.tappay.mn/glossary.md#customer) pays by QR or by card.

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

Your key needs the `terminal_payments:write` [scope](https://docs.tappay.mn/glossary.md#scope). With your merchant [secret key](https://docs.tappay.mn/glossary.md#secret-key), `sk_test_YOUR_SECRET_KEY`, add the scope in the portal. Link the bank terminal first in the portal under Business, Terminals, Bank POS. Use [sandbox](https://docs.tappay.mn/glossary.md#sandbox) keys while you build.

## Steps {#steps}

### List your bank terminals {#list-bank-terminals}

Read the linked bank terminals. Each item has the `id` you send as `bank_terminal_id`, the bank, the `tid` and the `display_name`. Only terminals bound to a payment point appear.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/bank-terminals" \
  -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 terminals = await tappay.bankTerminals.list();
console.log(JSON.stringify(terminals));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$terminals = $tappay->bankTerminals->list();
echo json_encode($terminals);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
terminals = client.bank_terminals.list()
print(json.dumps(terminals))
```

### Push a payment {#create-terminal-payment}

Send `bank_terminal_id` and `amount`, with an optional `description` and `orderId`. TapPay answers `201` and delivers the amount to the terminal. Send an `Idempotency-Key` so a retry creates no second payment.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/terminal-payments" \
  -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 '{"bank_terminal_id":"BANK_TERMINAL_ID","amount":1000,"description":"Order 1","orderId":"order-'"$(uuidgen)"'"}'
```

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

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const payment = await tappay.terminalPayments.create({
  body: {
    bank_terminal_id: 'BANK_TERMINAL_ID',
    amount: 1000,
    description: 'Order 1',
    orderId: `order-${crypto.randomUUID()}`,
  },
});
console.log(JSON.stringify(payment));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$payment = $tappay->terminalPayments->create([
    'body' => [
        'bank_terminal_id' => 'BANK_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)) . '',
    ],
]);
echo json_encode($payment);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
payment = client.terminal_payments.create({
    "body": {
        "bank_terminal_id": "BANK_TERMINAL_ID",
        "amount": 1000,
        "description": "Order 1",
        "orderId": "order-" + str(uuid.uuid4()) + "",
    },
})
print(json.dumps(payment))
```

### Read the payment {#get-terminal-payment}

Read the payment to see its `status`. After the customer pays, `paid_method` is `QR` or `CARD`. For `QR`, `payment_id` references the TapPay payment. For `CARD`, the `card` object holds `bin`, `last4`, `brand`, `auth_code` and `rrn`.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/terminal-payments/TERMINAL_PAYMENT_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 payment = await tappay.terminalPayments.retrieve('TERMINAL_PAYMENT_ID');
console.log(JSON.stringify(payment));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$payment = $tappay->terminalPayments->retrieve('TERMINAL_PAYMENT_ID');
echo json_encode($payment);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
payment = client.terminal_payments.retrieve("TERMINAL_PAYMENT_ID")
print(json.dumps(payment))
```

### Cancel a payment {#cancel-terminal-payment}

Cancel a payment that the customer has not paid yet. Cancel returns `409` with `POS-086` when the card step is in progress, `409` with `POS-084` when the payment is already closed, and `404` with `POS-083` when it does not exist.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/terminal-payments/TERMINAL_PAYMENT_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 payment = await tappay.terminalPayments.cancel('TERMINAL_PAYMENT_ID');
console.log(JSON.stringify(payment));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$payment = $tappay->terminalPayments->cancel('TERMINAL_PAYMENT_ID');
echo json_encode($payment);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
payment = client.terminal_payments.cancel("TERMINAL_PAYMENT_ID")
print(json.dumps(payment))
```

## Verify {#verify}

Treat the payment as paid only when `status` is `PAID`. Do not trust a webhook body alone. Read the payment and check `paid_method` and `amount` against your order.

Subscribe to these [events](https://docs.tappay.mn/glossary.md#event) as in the [webhook guide](https://docs.tappay.mn/guides/webhooks.md): `terminal_payment.delivered`, `terminal_payment.paid`, `terminal_payment.declined`, `terminal_payment.cancelled`, `terminal_payment.failed` and `terminal_payment.card_voided`. Each event is thin and holds only `id`, `type` and `objectId`. Read the payment by `objectId` to get the full state.

## Common mistakes {#common-mistakes}

- Sending a second payment to a busy terminal. TapPay answers `409` with `POS-082`, so wait for the first payment to end.
- Cancelling while the card is in progress. TapPay answers `409` with `POS-086`, so wait for the result instead.
- Trusting the webhook body. It carries no amount or status, so always read the payment.
- Using a key without `terminal_payments:write`. TapPay refuses the call, so add the scope to the key.
- Pushing to a bank terminal whose link is inactive. TapPay answers `422` with `POS-081`, so reactivate the link in the portal.
- Pushing to a terminal with no payment point. TapPay answers `422` with `POS-093`, so bind a payment point first.
- Sending a new `Idempotency-Key` on every retry. Reuse the same key to avoid a second push.

## Next steps {#next-steps}

See the [webhook guide](https://docs.tappay.mn/guides/webhooks.md) for [signature](https://docs.tappay.mn/glossary.md#signature) and retries, and the [POS terminal guide](https://docs.tappay.mn/guides/pos-terminal.md) for QR payments on a till.
