Skip to content

Create a POS QR payment

View as Markdown

Creates a QR payment on a card terminal and returns the EMVCo payload that the terminal shows to the payer. The payment starts as OPEN.

Changes in 2026-09-27

POST /api/pos/v1/qr

Authentication

Secret key (Bearer)

Headers

NameTypeRequiredValuesDescription
X-TapPay-Request-Timestampstringyes
X-TapPay-Request-Signaturestringyes
Idempotency-Keystringyes

Request body

NameTypeRequiredValuesDescription
pos_referencestringyes
amountnumberyes
currencystringyes
card_terminalobjectyes
card_terminal.terminal_codestringyes
card_terminal.merchant_codestringyes
card_terminal.merchant_namestringno
card_terminal.accountobjectno
card_terminal.account.bank_codestringyes
card_terminal.account.account_nostringyes
card_terminal.account.holder_namestringyes
card_terminal.mccstringno
card_terminal.branchobjectno
card_terminal.branch.branchNostringyes
card_terminal.branch.citystringyes
card_terminal.branch.districtstringyes
splitarray<object>no
split[].merchant_idstringyes
split[].percentnumberyes
split[].ebarimt_rolestringnoSELLER, PLATFORM
payment_point_idstring (uuid)no

Response 201

NameTypeRequiredValuesDescription
payment_idstringyes
qr_refstringyes
statusstringyesOPEN
amountnumberyes
service_feenumber | nullyes
totalnumberyes
currencystringyes
narrativestring | nullyesStatement narrative TapPay builds: <terminal narrative_name> <token> (max 50); null when the intent has no token
emvco_payloadstringyes
expires_atstringyes

Errors

CodeStatusMessage
POS-002401The POS access token is missing, invalid or expired.
POS-003401The POS API key is invalid or revoked.
POS-004401The request timestamp is outside the allowed time window.
POS-005401The request signature is invalid.
POS-006401This request signature was already used.
AUTH-055403The caller's scope does not allow this operation.
POS-007401A client certificate is required for this request.
VAL-002400A required field or header is missing.
VAL-010409This Idempotency-Key was already used with a different request body.
VAL-013409A request with this Idempotency-Key is still being processed.
POS-091403The terminal push flow is not enabled for this POS client.
QR-008422The payment point does not belong to this terminal or is not active.
TOKEN=$(curl -sS -X POST "https://sandbox-api.tappay.mn/api/pos/v1/auth/token" -H "Content-Type: application/json" -d '{"grant_type":"client_credentials","client_id":"YOUR_POS_CLIENT_ID","client_secret":"YOUR_POS_CLIENT_SECRET"}' | sed -E 's/.*"access_token":"([^"]+)".*/\1/')
BODY='{"pos_reference":"pos-'"$(uuidgen)"'","narrative":"Order #1001","amount":1000,"currency":"MNT","card_terminal":{"terminal_code":"T-SANDBOX-POS","merchant_code":"M-SANDBOX-POS"}}'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
SIG=$(printf '%s\n%s\n%s\n%s' 'POST' '/api/pos/v1/qr' "$TS" "$BODY" | openssl dgst -sha256 -hmac 'YOUR_POS_SIGNING_SECRET' | sed 's/^.* //')
curl -sS -X POST "https://sandbox-api.tappay.mn/api/pos/v1/qr" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-API-Key: YOUR_POS_API_KEY" \
  -H "X-TapPay-Request-Timestamp: $TS" \
  -H "X-TapPay-Request-Signature: sha256=$SIG" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d "$BODY"
import { PosClient } from '@tappay-mn/node';

const pos = new PosClient({
  clientId: 'YOUR_POS_CLIENT_ID',
  clientSecret: 'YOUR_POS_CLIENT_SECRET',
  apiKey: 'YOUR_POS_API_KEY',
  signingSecret: 'YOUR_POS_SIGNING_SECRET',
  environment: 'sandbox',
  baseUrl: 'https://sandbox-api.tappay.mn',
});
const payment = await pos.payments.createQr({
  body: {
    pos_reference: `pos-${crypto.randomUUID()}`,
    narrative: 'Order #1001',
    amount: 1000,
    currency: 'MNT',
    card_terminal: {
      terminal_code: 'T-SANDBOX-POS',
      merchant_code: 'M-SANDBOX-POS',
    },
  },
});
console.log(JSON.stringify(payment));
<?php
require 'vendor/autoload.php';

use TapPay\Pos\PosClient;

$pos = new PosClient([
    'clientId' => 'YOUR_POS_CLIENT_ID',
    'clientSecret' => 'YOUR_POS_CLIENT_SECRET',
    'apiKey' => 'YOUR_POS_API_KEY',
    'signingSecret' => 'YOUR_POS_SIGNING_SECRET',
    'environment' => 'sandbox',
    'baseUrl' => 'https://sandbox-api.tappay.mn',
]);
$payment = $pos->payments->createQr([
    'body' => [
        'pos_reference' => 'pos-' . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)) . '',
        'narrative' => 'Order #1001',
        'amount' => 1000,
        'currency' => 'MNT',
        'card_terminal' => [
            'terminal_code' => 'T-SANDBOX-POS',
            'merchant_code' => 'M-SANDBOX-POS',
        ],
    ],
]);
echo json_encode($payment);
import json
import uuid
import tappay

pos = tappay.PosClient(
    client_id="YOUR_POS_CLIENT_ID",
    client_secret="YOUR_POS_CLIENT_SECRET",
    api_key="YOUR_POS_API_KEY",
    signing_secret="YOUR_POS_SIGNING_SECRET",
    environment="sandbox",
    base_url="https://sandbox-api.tappay.mn",
)
payment = pos.payments.create_qr({
    "body": {
        "pos_reference": "pos-" + str(uuid.uuid4()) + "",
        "narrative": "Order #1001",
        "amount": 1000,
        "currency": "MNT",
        "card_terminal": {
            "terminal_code": "T-SANDBOX-POS",
            "merchant_code": "M-SANDBOX-POS",
        },
    },
})
print(json.dumps(payment))
{
  "payment_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e0b",
  "qr_ref": "QR-20261009-0001",
  "status": "OPEN",
  "amount": 1000,
  "service_fee": null,
  "total": 1000,
  "currency": "MNT",
  "narrative": "Order #1001",
  "emvco_payload": "000201010212...6304ABCD",
  "expires_at": "2026-10-09T08:15:00.000Z"
}

In the sandbox use the terminal T-SANDBOX-POS of the merchant M-SANDBOX-POS. For the full flow, read the POS terminal guide.