Skip to content

Push a payment to a bank POS terminal

View as Markdown

Overview

A bank POS terminal is a card machine of your bank. You link it to a payment point in the portal. Your till sends an amount and the customer pays by QR or by card.

Before you begin

Your key needs the terminal_payments:write scope. With your merchant 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 keys while you build.

Steps

List your 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.

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

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

Push a 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.

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)"'"}'
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
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);
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

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.

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"
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
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);
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 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.

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)"
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
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);
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

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 as in the webhook guide: 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

  • 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

See the webhook guide for signature and retries, and the POS terminal guide for QR payments on a till.