Accept a POS customer code
Accepts the code that the payer shows from the wallet app (consumer-presented mode, CPM) on a card terminal. The terminal scans the code and sends it as payload. The payment is ACCEPTED and its final status comes later.
Changes in 2026-09-27This operation is not available in this version.
POST /api/pos/v1/cpm
Authentication
Secret key (Bearer)
Headers
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
X-TapPay-Request-Timestamp | string | yes | ||
X-TapPay-Request-Signature | string | yes | ||
Idempotency-Key | string | yes |
Request body
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
pos_reference | string | yes | ||
amount | number | yes | ||
currency | string | yes | ||
card_terminal | object | yes | ||
card_terminal.terminal_code | string | yes | ||
card_terminal.merchant_code | string | yes | ||
card_terminal.merchant_name | string | no | ||
card_terminal.account | object | no | ||
card_terminal.account.bank_code | string | yes | ||
card_terminal.account.account_no | string | yes | ||
card_terminal.account.holder_name | string | yes | ||
card_terminal.mcc | string | no | ||
card_terminal.branch | object | no | ||
card_terminal.branch.branchNo | string | yes | ||
card_terminal.branch.city | string | yes | ||
card_terminal.branch.district | string | yes | ||
split | array<object> | no | ||
split[].merchant_id | string | yes | ||
split[].percent | number | yes | ||
split[].ebarimt_role | string | no | SELLER, PLATFORM | |
payload | string | yes |
Response 200
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
payment_id | string | yes | ||
status | string | yes | ACCEPTED | |
pos_reference | string | yes |
Errors
| Code | Status | Message |
|---|---|---|
POS-002 | 401 | The POS access token is missing, invalid or expired. |
POS-003 | 401 | The POS API key is invalid or revoked. |
POS-004 | 401 | The request timestamp is outside the allowed time window. |
POS-005 | 401 | The request signature is invalid. |
POS-006 | 401 | This request signature was already used. |
AUTH-055 | 403 | The caller's scope does not allow this operation. |
POS-007 | 401 | A client certificate is required for this request. |
VAL-002 | 400 | A required field or header is missing. |
VAL-010 | 409 | This Idempotency-Key was already used with a different request body. |
VAL-013 | 409 | A request with this Idempotency-Key is still being processed. |
POS-091 | 403 | The terminal push flow is not enabled for this POS client. |
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 #1002","amount":1000,"currency":"MNT","card_terminal":{"terminal_code":"T-SANDBOX-POS","merchant_code":"M-SANDBOX-POS"},"payload":"hQVDUFYwMWEjTwfwVEFQUEFZUAZUQVBQQVljEN8BDU5LMDAwMDJUOVI2SDU="}'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
SIG=$(printf '%s\n%s\n%s\n%s' 'POST' '/api/pos/v1/cpm' "$TS" "$BODY" | openssl dgst -sha256 -hmac 'YOUR_POS_SIGNING_SECRET' | sed 's/^.* //')
curl -sS -X POST "https://sandbox-api.tappay.mn/api/pos/v1/cpm" \
-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.createCpm({
body: {
pos_reference: `pos-${crypto.randomUUID()}`,
narrative: 'Order #1002',
amount: 1000,
currency: 'MNT',
card_terminal: {
terminal_code: 'T-SANDBOX-POS',
merchant_code: 'M-SANDBOX-POS',
},
payload: 'hQVDUFYwMWEjTwfwVEFQUEFZUAZUQVBQQVljEN8BDU5LMDAwMDJUOVI2SDU=',
},
});
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->createCpm([
'body' => [
'pos_reference' => 'pos-' . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)) . '',
'narrative' => 'Order #1002',
'amount' => 1000,
'currency' => 'MNT',
'card_terminal' => [
'terminal_code' => 'T-SANDBOX-POS',
'merchant_code' => 'M-SANDBOX-POS',
],
'payload' => 'hQVDUFYwMWEjTwfwVEFQUEFZUAZUQVBQQVljEN8BDU5LMDAwMDJUOVI2SDU=',
],
]);
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_cpm({
"body": {
"pos_reference": "pos-" + str(uuid.uuid4()) + "",
"narrative": "Order #1002",
"amount": 1000,
"currency": "MNT",
"card_terminal": {
"terminal_code": "T-SANDBOX-POS",
"merchant_code": "M-SANDBOX-POS",
},
"payload": "hQVDUFYwMWEjTwfwVEFQUEFZUAZUQVBQQVljEN8BDU5LMDAwMDJUOVI2SDU=",
},
})
print(json.dumps(payment)){
"payment_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e0b",
"status": "ACCEPTED",
"pos_reference": "pos-1002"
}
In the sandbox use the terminal T-SANDBOX-POS of the merchant M-SANDBOX-POS. For the full flow, read the POS terminal guide.