# Хадгалсан төлбөрийн хэрэгслээс төлбөр авах

> Үйлчлүүлэгчийг байлцуулалгүйгээр хадгалсан төлбөрийн хэрэгслээс нь төлбөр авна.

Эх: https://docs.tappay.mn/mn/reference/payments/create/

[Үйлчлүүлэгчийг](https://docs.tappay.mn/mn/glossary.md#customer) байлцуулалгүйгээр хадгалсан [төлбөрийн](https://docs.tappay.mn/mn/glossary.md#payment) хэрэгслээс нь төлбөр авна. `customer`, `paymentMethod`, `amount`, `description` илгээнэ.

`POST /api/v1/payments` Хувилбар 2026-09-27

### Нэвтрэлт

Secret key (Bearer)

### Header

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `TapPay-Version` | string | үгүй | | |
| `TapPay-Timestamp` | string | үгүй | | |
| `TapPay-Nonce` | string | үгүй | | |
| `TapPay-Signature` | string | үгүй | | |
| `Idempotency-Key` | string | тийм | | |

### Хүсэлтийн бие

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `customer` | string | тийм | | |
| `paymentMethod` | string | тийм | | |
| `amount` | number | тийм | | |
| `description` | string | тийм | | |
| `orderId` | string | үгүй | | |
| `terminalId` | string (uuid) | үгүй | | |

### Хариу 201

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `success` | boolean | тийм | `true` | |
| `data` | object | тийм | | |
| `data.id` | string | тийм | | |
| `data.intentId` | string | тийм | | |
| `data.invoiceId` | string \| null | тийм | | |
| `data.status` | string | тийм | `PROCESSING`, `SUCCEEDED`, `FAILED`, `OVERPAID`, `AUTHORIZED`, `CANCELLED` | |
| `data.amount` | number | тийм | | |
| `data.currency` | string | тийм | | |
| `data.channel` | string | тийм | `QPAY`, `NODE_QR`, `WECHAT`, `CARD`, `R2P` | |
| `data.payerWallet` | object \| null | тийм | | |
| `data.payerWallet.code` | string | тийм | | |
| `data.payerWallet.name` | string | тийм | | |
| `data.payerWallet.logoUrl` | string \| null | тийм | | |
| `data.payerWallet.type` | string | тийм | `APP`, `WEB`, `WECHAT` | |
| `data.sticker` | object \| null | тийм | | |
| `data.sticker.serialNo` | string \| null | тийм | | |
| `data.sticker.sqrRef` | string | тийм | | |
| `data.sticker.name` | string \| null | тийм | | |
| `data.feeAmount` | number \| null | тийм | | |
| `data.merchantNet` | number \| null | тийм | | |
| `data.serviceFeeMerchant` | number | тийм | | |
| `data.serviceFeeCustomer` | number | тийм | | |
| `data.succeededAt` | string \| null | тийм | | |
| `data.createdAt` | string | тийм | | |
| `data.fulfillment` | object \| null | тийм | | |
| `data.fulfillment.status` | string | тийм | `PENDING`, `IN_PROGRESS`, `COMPLETED`, `FAILED`, `CANCELLED` | |
| `data.fulfillment.stage` | string \| null | тийм | | |
| `data.fulfillment.message` | string \| null | тийм | | |
| `data.fulfillment.updatedAt` | string (date-time) | тийм | | |
| `data.receipt` | object \| null | тийм | | |
| `data.receipt.receipt` | object | тийм | | |
| `data.receipt.receipt.id` | string (uuid) | тийм | | |
| `data.receipt.receipt.status` | string | тийм | `PENDING`, `REGISTERED`, `FAILED`, `RETURNED` | |
| `data.receipt.receipt.issuer` | string | тийм | `MERCHANT`, `NODE` | |
| `data.receipt.receipt.receiptType` | string \| null | тийм | `B2C`, `B2B`, `SALES`, `null` | |
| `data.receipt.receipt.ddtd` | string \| null | тийм | | |
| `data.receipt.receipt.lottery` | string \| null | тийм | | |
| `data.receipt.receipt.qrData` | string \| null | тийм | | |
| `data.receipt.receipt.url` | string \| null | тийм | | |
| `data.receipt.receipt.merchantReceiptNo` | string \| null | тийм | | |
| `data.receipt.receipt.amount` | string \| null | тийм | | |
| `data.receipt.receipt.vat` | string \| null | тийм | | |
| `data.receipt.receipt.cityTax` | string \| null | тийм | | |
| `data.receipt.receipt.issuedAt` | string \| null | тийм | | |
| `data.receipt.receipt.returnedAt` | string \| null | тийм | | |
| `data.receipt.receipt.failureReason` | string \| null | тийм | | |
| `data.receipt.receipt.lines` | array \| null | тийм | | |
| `data.receipt.receipt.attempts` | integer | тийм | | |
| `data.receipt.receipt.nextAttemptAt` | string \| null | тийм | | |
| `data.receipt.receipt.recipientFallback` | boolean | тийм | | |
| `data.receipt.receipt.parts` | array \| null | тийм | | |
| `data.receipt.history` | array\<object> | тийм | | |
| `data.receipt.history[].id` | string (uuid) | тийм | | |
| `data.receipt.history[].status` | string | тийм | `PENDING`, `REGISTERED`, `FAILED`, `RETURNED` | |
| `data.receipt.history[].issuer` | string | тийм | `MERCHANT`, `NODE` | |
| `data.receipt.history[].receiptType` | string \| null | тийм | `B2C`, `B2B`, `SALES`, `null` | |
| `data.receipt.history[].ddtd` | string \| null | тийм | | |
| `data.receipt.history[].lottery` | string \| null | тийм | | |
| `data.receipt.history[].qrData` | string \| null | тийм | | |
| `data.receipt.history[].url` | string \| null | тийм | | |
| `data.receipt.history[].merchantReceiptNo` | string \| null | тийм | | |
| `data.receipt.history[].amount` | string \| null | тийм | | |
| `data.receipt.history[].vat` | string \| null | тийм | | |
| `data.receipt.history[].cityTax` | string \| null | тийм | | |
| `data.receipt.history[].issuedAt` | string \| null | тийм | | |
| `data.receipt.history[].returnedAt` | string \| null | тийм | | |
| `data.receipt.history[].failureReason` | string \| null | тийм | | |
| `data.receipt.history[].lines` | array \| null | тийм | | |
| `data.receipt.history[].attempts` | integer | тийм | | |
| `data.receipt.history[].nextAttemptAt` | string \| null | тийм | | |
| `data.receipt.history[].recipientFallback` | boolean | тийм | | |
| `data.receipt.history[].parts` | array \| null | тийм | | |
| `data.ebarimt` | object \| null | тийм | | |
| `data.ebarimt.id` | string (uuid) | тийм | | |
| `data.ebarimt.status` | string | тийм | `PENDING`, `REGISTERED`, `FAILED`, `RETURNED` | |
| `data.ebarimt.issuer` | string | тийм | `MERCHANT`, `NODE` | |
| `data.ebarimt.receiptType` | string \| null | тийм | `B2C`, `B2B`, `SALES`, `null` | |
| `data.ebarimt.ddtd` | string \| null | тийм | | |
| `data.ebarimt.lottery` | string \| null | тийм | | |
| `data.ebarimt.qrData` | string \| null | тийм | | |
| `data.ebarimt.url` | string \| null | тийм | | |
| `data.ebarimt.merchantReceiptNo` | string \| null | тийм | | |
| `data.ebarimt.amount` | string \| null | тийм | | |
| `data.ebarimt.vat` | string \| null | тийм | | |
| `data.ebarimt.cityTax` | string \| null | тийм | | |
| `data.ebarimt.issuedAt` | string \| null | тийм | | |
| `data.ebarimt.returnedAt` | string \| null | тийм | | |
| `data.ebarimt.failureReason` | string \| null | тийм | | |
| `data.ebarimt.lines` | array \| null | тийм | | |
| `data.ebarimt.attempts` | integer | тийм | | |
| `data.ebarimt.nextAttemptAt` | string \| null | тийм | | |
| `data.ebarimt.recipientFallback` | boolean | тийм | | |
| `data.ebarimt.parts` | array \| null | тийм | | |
| `data.authorizationType` | string | тийм | `FINAL`, `PREAUTH` | |
| `data.preauthMode` | string \| null | тийм | `CHARGE_REFUND`, `HOLD`, `null` | |
| `data.preauthStatus` | string \| null | тийм | `OPEN`, `FINALIZED`, `AUTO_FINALIZED`, `null` | |
| `data.finalAmount` | string \| null | тийм | | |
| `data.finalizeDueAt` | string \| null | тийм | | |
| `data.authorizedAt` | string \| null | тийм | | |
| `data.preauthRefundId` | string \| null | тийм | | |
| `data.paymentMethodId` | string | үгүй | | |
| `data.customer` | string | үгүй | | |
| `data.failureCode` | string \| null | үгүй | | |
| `data.declineRetryable` | boolean | үгүй | | |
| `data.ebarimtRecipient` | object \| null | тийм | | |
| `data.ebarimtRecipient.type` | string | тийм | `CITIZEN`, `ORG`, `NONE` | |
| `data.ebarimtRecipient.register` | string \| null | тийм | | |
| `data.ebarimtRecipient.tin` | string \| null | тийм | | |
| `data.ebarimtRecipient.email` | string \| null | тийм | | |
| `data.settlement` | object \| null | тийм | | |
| `data.settlement.cycleId` | string (uuid) | тийм | | |
| `data.settlement.businessDate` | string | тийм | | |
| `data.settlement.seq` | integer | тийм | | |
| `data.settlement.status` | string | тийм | `OPEN`, `RUNNING`, `CLOSED`, `CARRIED` | |
| `data.settlement.credited` | boolean | тийм | | |
| `data.promotions` | array\<object> | үгүй | | |
| `data.promotions[].promotionId` | string (uuid) | тийм | | |
| `data.promotions[].kind` | string | тийм | | |
| `data.promotions[].amount` | number | тийм | | |

### Алдаа

| Код | Status | Мессеж |
| - | - | - |
| [`AUTH-001`](https://docs.tappay.mn/mn/errors.md#AUTH-001) | 401 | API key байхгүй, буруу эсвэл хүчингүй болсон байна. |
| [`EVT-206`](https://docs.tappay.mn/mn/errors.md#EVT-206) | 401 | Production key sandbox-д хүлээн авахгүй. Sandbox key (sk_test\_/pk_test\_) ашиглана уу. |
| [`EVT-207`](https://docs.tappay.mn/mn/errors.md#EVT-207) | 401 | Sandbox key production-д хүлээн авахгүй. Production key (sk_live\_/pk_live\_) ашиглана уу. |
| [`AUTH-018`](https://docs.tappay.mn/mn/errors.md#AUTH-018) | 403 | Хүсэлт түлхүүрийн зөвшөөрөгдсөн IP жагсаалтад ороогүй хаягаас ирсэн. |
| [`AUTH-058`](https://docs.tappay.mn/mn/errors.md#AUTH-058) | 403 | API key-д энэ үйлдэлд шаардлагатай scope байхгүй байна. |
| [`SIG-002`](https://docs.tappay.mn/mn/errors.md#SIG-002) | 401 | Хүсэлтийн цагийн тэмдэг зөвшөөрөгдсөн хугацааны гадна байна. |
| [`SIG-003`](https://docs.tappay.mn/mn/errors.md#SIG-003) | 401 | Хүсэлтийн гарын үсэг байхгүй эсвэл таарахгүй байна. |
| [`SIG-005`](https://docs.tappay.mn/mn/errors.md#SIG-005) | 409 | Энэ хүсэлтийн nonce өмнө нь ашиглагдсан байна. |
| [`VAL-014`](https://docs.tappay.mn/mn/errors.md#VAL-014) | 400 | TapPay-Version header нь мэдэгдэх API хувилбар биш байна. |
| [`BIZ-004`](https://docs.tappay.mn/mn/errors.md#BIZ-004) | 403 | Terminal идэвхгүй байна. |
| [`BIZ-005`](https://docs.tappay.mn/mn/errors.md#BIZ-005) | 403 | Мерчантын данс энэ хүсэлтийг зөвшөөрөх төлөвт байхгүй байна. |
| [`VAL-002`](https://docs.tappay.mn/mn/errors.md#VAL-002) | 400 | Заавал байх талбар эсвэл header дутуу байна. |
| [`VAL-010`](https://docs.tappay.mn/mn/errors.md#VAL-010) | 409 | Энэ Idempotency-Key өөр хүсэлтийн биетэй өмнө нь ашиглагдсан байна. |
| [`VAL-013`](https://docs.tappay.mn/mn/errors.md#VAL-013) | 409 | Энэ Idempotency-Key-тэй хүсэлт боловсруулагдаж байна. |
| [`VAL-001`](https://docs.tappay.mn/mn/errors.md#VAL-001) | 400 | Хүсэлт шалгалтад тэнцсэнгүй. |
| [`VAL-005`](https://docs.tappay.mn/mn/errors.md#VAL-005) | 400 | Огнооны утга буруу байна. |
| [`VAL-009`](https://docs.tappay.mn/mn/errors.md#VAL-009) | 400 | Тэмдэгт мөрийн утга зөвшөөрөгдсөн дээд уртаас урт байна. |
| [`PAY-001`](https://docs.tappay.mn/mn/errors.md#PAY-001) | 404 | Нэхэмжлэх олдсонгүй. |
| [`PAY-012`](https://docs.tappay.mn/mn/errors.md#PAY-012) | 409 | Төлбөрийн intent нээлттэй биш болсон байна. |
| [`PAY-017`](https://docs.tappay.mn/mn/errors.md#PAY-017) | 422 | Дүн төлөх үлдэгдлээс их байна. |
| [`PAY-027`](https://docs.tappay.mn/mn/errors.md#PAY-027) | 409 | Нэхэмжлэх одоогийн төлөвт төлөгдөх боломжгүй байна. |
| [`PAY-031`](https://docs.tappay.mn/mn/errors.md#PAY-031) | 422 | Customer олдсонгүй. |
| [`BIZ-002`](https://docs.tappay.mn/mn/errors.md#BIZ-002) | 400 | Мерчантын өдрийн лимит хэтрэх байна. |
| [`BIZ-013`](https://docs.tappay.mn/mn/errors.md#BIZ-013) | 404 | Terminal олдсонгүй. |
| [`SET-002`](https://docs.tappay.mn/mn/errors.md#SET-002) | 400 | Шаардлагатай платформын тохиргоо байхгүй эсвэл тодорхойгүй байна. |
| [`SET-007`](https://docs.tappay.mn/mn/errors.md#SET-007) | 422 | Утга платформын хязгаарыг зөрчиж байна. |
| [`FSC-013`](https://docs.tappay.mn/mn/errors.md#FSC-013) | 500 | Очих газрыг тодорхойлж чадаагүй тул шимтгэл тооцоолж чадсангүй. |
| [`PYO-207`](https://docs.tappay.mn/mn/errors.md#PYO-207) | 422 | Split-ийн хүртэгч идэвхгүй байна. |
| [`EVT-202`](https://docs.tappay.mn/mn/errors.md#EVT-202) | 422 | Тест картын дугаар мэдэгдэх sandbox тест карт биш байна. |
| [`AFP-001`](https://docs.tappay.mn/mn/errors.md#AFP-001) | 409 | Төлбөрийн intent өөр үйлдлээр түгжигдсэн байна. |
| [`RCR-002`](https://docs.tappay.mn/mn/errors.md#RCR-002) | 422 | Customer хүсэлтийн бие буруу байна. |
| [`RCR-003`](https://docs.tappay.mn/mn/errors.md#RCR-003) | 404 | Төлбөрийн хэрэгсэл олдсонгүй. |
| [`RCR-004`](https://docs.tappay.mn/mn/errors.md#RCR-004) | 422 | Энэ төрлийн төлбөрийн хэрэгсэл боломжгүй байна. |
| [`RCR-012`](https://docs.tappay.mn/mn/errors.md#RCR-012) | 422 | Энэ төлбөрт шаардлагатай провайдерын credential тохируулаагүй байна. |
| [`RCR-051`](https://docs.tappay.mn/mn/errors.md#RCR-051) | 422 | Мерчантаас эхлүүлэх төлбөр энэ мерчантад идэвхжээгүй байна. |
| [`RCR-052`](https://docs.tappay.mn/mn/errors.md#RCR-052) | 422 | Төлбөрийн хэрэгслийг ашиглахын өмнө худалдан авагч үйлдэл хийх шаардлагатай. |
| [`RCR-053`](https://docs.tappay.mn/mn/errors.md#RCR-053) | 422 | Төлбөрийн хэрэгсэл идэвхгүй байна. |
| [`RCR-054`](https://docs.tappay.mn/mn/errors.md#RCR-054) | 422 | Энэ төлбөрийн суваг мерчантаас эхлүүлэх төлбөрийг дэмжихгүй. |
| [`RCR-055`](https://docs.tappay.mn/mn/errors.md#RCR-055) | 422 | Mandate-ийн лимит энэ төлбөрийг зөвшөөрөхгүй байна. |
| [`RCR-056`](https://docs.tappay.mn/mn/errors.md#RCR-056) | 422 | Мерчантаас эхлүүлсэн төлбөрийн дахин оролдлогын хязгаарт хүрсэн. |
| [`RCR-057`](https://docs.tappay.mn/mn/errors.md#RCR-057) | 422 | Төлбөрийн хэрэгслийн зориулалт энэ төлбөртэй таарахгүй байна. |
| [`SVC-044`](https://docs.tappay.mn/mn/errors.md#SVC-044) | 422 | Мерчантын үйлчилгээний тохиргоо буруу байна. |
| [`PRE-002`](https://docs.tappay.mn/mn/errors.md#PRE-002) | 422 | Хүсэлтийн талбар pre-auth төлбөрт зөвшөөрөгдөхгүй байна. |
| [`PRE-014`](https://docs.tappay.mn/mn/errors.md#PRE-014) | 422 | Capture-ийн арга энэ төлбөрт зөвшөөрөгдөхгүй байна. |
| [`RCR-059`](https://docs.tappay.mn/mn/errors.md#RCR-059) | 422 | Картын token-ий хүрээ энэ төлбөрийг зөвшөөрөхгүй байна. |

Playground-д туршиж үзэх: https://docs.tappay.mn/mn/reference/payments/create/

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/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 '{"terminalId":"YOUR_TERMINAL_ID","customer":"CUSTOMER_ID","paymentMethod":"PAYMENT_METHOD_ID","amount":500,"description":"Monthly fee"}'
```

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

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const payment = await tappay.payments.create({
  body: {
    terminalId: 'YOUR_TERMINAL_ID',
    customer: 'CUSTOMER_ID',
    paymentMethod: 'PAYMENT_METHOD_ID',
    amount: 500,
    description: 'Monthly fee',
  },
});
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->payments->create([
    'body' => [
        'terminalId' => 'YOUR_TERMINAL_ID',
        'customer' => 'CUSTOMER_ID',
        'paymentMethod' => 'PAYMENT_METHOD_ID',
        'amount' => 500,
        'description' => 'Monthly fee',
    ],
]);
echo json_encode($payment);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
payment = client.payments.create({
    "body": {
        "terminalId": "YOUR_TERMINAL_ID",
        "customer": "CUSTOMER_ID",
        "paymentMethod": "PAYMENT_METHOD_ID",
        "amount": 500,
        "description": "Monthly fee",
    },
})
print(json.dumps(payment))
```

```json title="Response"
{
  "success": true,
  "data": {
    "id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e04",
    "ebarimt": null,
    "intentId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e03",
    "invoiceId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e01",
    "status": "SUCCEEDED",
    "amount": 500,
    "currency": "MNT",
    "channel": "CARD",
    "payerWallet": null,
    "sticker": null,
    "feeAmount": 8,
    "merchantNet": 492,
    "serviceFeeMerchant": 0,
    "serviceFeeCustomer": 0,
    "succeededAt": "2026-10-03T08:16:12.000Z",
    "createdAt": "2026-10-03T08:16:12.000Z",
    "fulfillment": null,
    "receipt": null,
    "authorizationType": "FINAL",
    "preauthMode": null,
    "preauthStatus": null,
    "finalAmount": null,
    "finalizeDueAt": null,
    "authorizedAt": null,
    "preauthRefundId": null,
    "ebarimtRecipient": null,
    "settlement": null
  }
}
```

> **Анхаар:** **Мерчантаас эхэлсэн төлбөр**
>
> Энэ дуудлагад үйлчлүүлэгчийн үйлдэл шаардлагагүй. Таны мерчантад мерчантаас эхлэх төлбөр идэвхжээгүй бол `422` болон `RCR-051` буцаана.

Бүтэн урсгалыг [гарын авлагаас](https://docs.tappay.mn/mn/guides/customers-recurring.md) үзнэ үү.
