Skip to content

Finalize a held payment

View as Markdown

Captures a payment whose amount is held on the customer’s card. The amount can be equal to or lower than the held amount.

Changes in 2026-09-27

POST /api/v1/payments/{id}/finalizeSince 2026-09-27

Authentication

Secret key (Bearer)

Headers

NameTypeRequiredValuesDescription
TapPay-Versionstringno
TapPay-Timestampstringno
TapPay-Noncestringno
TapPay-Signaturestringno
Idempotency-Keystringyes

Path parameters

NameTypeRequiredValuesDescription
idstring (uuid)yes

Request body

NameTypeRequiredValuesDescription
amountstringyes

Response 200

NameTypeRequiredValuesDescription
successbooleanyestrue
dataobjectyes
data.idstringyes
data.intentIdstringyes
data.invoiceIdstring | nullyes
data.statusstringyesPROCESSING, SUCCEEDED, FAILED, OVERPAID, AUTHORIZED, CANCELLED
data.amountnumberyes
data.currencystringyes
data.channelstringyesQPAY, NODE_QR, WECHAT, CARD, R2P
data.payerWalletobject | nullyes
data.payerWallet.codestringyes
data.payerWallet.namestringyes
data.payerWallet.logoUrlstring | nullyes
data.payerWallet.typestringyesAPP, WEB, WECHAT
data.stickerobject | nullyes
data.sticker.serialNostring | nullyes
data.sticker.sqrRefstringyes
data.sticker.namestring | nullyes
data.feeAmountnumber | nullyes
data.merchantNetnumber | nullyes
data.serviceFeeMerchantnumberyes
data.serviceFeeCustomernumberyes
data.succeededAtstring | nullyes
data.createdAtstringyes
data.fulfillmentobject | nullyes
data.fulfillment.statusstringyesPENDING, IN_PROGRESS, COMPLETED, FAILED, CANCELLED
data.fulfillment.stagestring | nullyes
data.fulfillment.messagestring | nullyes
data.fulfillment.updatedAtstring (date-time)yes
data.receiptobject | nullyes
data.receipt.receiptobjectyes
data.receipt.receipt.idstring (uuid)yes
data.receipt.receipt.statusstringyesPENDING, REGISTERED, FAILED, RETURNED
data.receipt.receipt.issuerstringyesMERCHANT, NODE
data.receipt.receipt.receiptTypestring | nullyesB2C, B2B, SALES, null
data.receipt.receipt.ddtdstring | nullyes
data.receipt.receipt.lotterystring | nullyes
data.receipt.receipt.qrDatastring | nullyes
data.receipt.receipt.urlstring | nullyes
data.receipt.receipt.merchantReceiptNostring | nullyes
data.receipt.receipt.amountstring | nullyes
data.receipt.receipt.vatstring | nullyes
data.receipt.receipt.cityTaxstring | nullyes
data.receipt.receipt.issuedAtstring | nullyes
data.receipt.receipt.returnedAtstring | nullyes
data.receipt.receipt.failureReasonstring | nullyes
data.receipt.receipt.linesarray | nullyes
data.receipt.receipt.attemptsintegeryes
data.receipt.receipt.nextAttemptAtstring | nullyes
data.receipt.receipt.recipientFallbackbooleanyes
data.receipt.receipt.partsarray | nullyes
data.receipt.historyarray<object>yes
data.receipt.history[].idstring (uuid)yes
data.receipt.history[].statusstringyesPENDING, REGISTERED, FAILED, RETURNED
data.receipt.history[].issuerstringyesMERCHANT, NODE
data.receipt.history[].receiptTypestring | nullyesB2C, B2B, SALES, null
data.receipt.history[].ddtdstring | nullyes
data.receipt.history[].lotterystring | nullyes
data.receipt.history[].qrDatastring | nullyes
data.receipt.history[].urlstring | nullyes
data.receipt.history[].merchantReceiptNostring | nullyes
data.receipt.history[].amountstring | nullyes
data.receipt.history[].vatstring | nullyes
data.receipt.history[].cityTaxstring | nullyes
data.receipt.history[].issuedAtstring | nullyes
data.receipt.history[].returnedAtstring | nullyes
data.receipt.history[].failureReasonstring | nullyes
data.receipt.history[].linesarray | nullyes
data.receipt.history[].attemptsintegeryes
data.receipt.history[].nextAttemptAtstring | nullyes
data.receipt.history[].recipientFallbackbooleanyes
data.receipt.history[].partsarray | nullyes
data.ebarimtobject | nullyes
data.ebarimt.idstring (uuid)yes
data.ebarimt.statusstringyesPENDING, REGISTERED, FAILED, RETURNED
data.ebarimt.issuerstringyesMERCHANT, NODE
data.ebarimt.receiptTypestring | nullyesB2C, B2B, SALES, null
data.ebarimt.ddtdstring | nullyes
data.ebarimt.lotterystring | nullyes
data.ebarimt.qrDatastring | nullyes
data.ebarimt.urlstring | nullyes
data.ebarimt.merchantReceiptNostring | nullyes
data.ebarimt.amountstring | nullyes
data.ebarimt.vatstring | nullyes
data.ebarimt.cityTaxstring | nullyes
data.ebarimt.issuedAtstring | nullyes
data.ebarimt.returnedAtstring | nullyes
data.ebarimt.failureReasonstring | nullyes
data.ebarimt.linesarray | nullyes
data.ebarimt.attemptsintegeryes
data.ebarimt.nextAttemptAtstring | nullyes
data.ebarimt.recipientFallbackbooleanyes
data.ebarimt.partsarray | nullyes
data.authorizationTypestringyesFINAL, PREAUTH
data.preauthModestring | nullyesCHARGE_REFUND, HOLD, null
data.preauthStatusstring | nullyesOPEN, FINALIZED, AUTO_FINALIZED, null
data.finalAmountstring | nullyes
data.finalizeDueAtstring | nullyes
data.authorizedAtstring | nullyes
data.preauthRefundIdstring | nullyes
data.paymentMethodIdstringno
data.customerstringno
data.failureCodestring | nullno
data.declineRetryablebooleanno
data.ebarimtRecipientobject | nullyes
data.ebarimtRecipient.typestringyesCITIZEN, ORG, NONE
data.ebarimtRecipient.registerstring | nullyes
data.ebarimtRecipient.tinstring | nullyes
data.ebarimtRecipient.emailstring | nullyes
data.settlementobject | nullyes
data.settlement.cycleIdstring (uuid)yes
data.settlement.businessDatestringyes
data.settlement.seqintegeryes
data.settlement.statusstringyesOPEN, RUNNING, CLOSED, CARRIED
data.settlement.creditedbooleanyes
data.promotionsarray<object>no
data.promotions[].promotionIdstring (uuid)yes
data.promotions[].kindstringyes
data.promotions[].amountnumberyes

Errors

CodeStatusMessage
AUTH-001401The API key is missing, invalid or revoked.
EVT-206401Production keys are not accepted in the sandbox. Use a sandbox key (sk_test_/pk_test_).
EVT-207401Sandbox keys are not accepted in production. Use a production key (sk_live_/pk_live_).
AUTH-018403The request came from an IP address that is not on the key's allowlist.
AUTH-058403The API key does not have the scope this operation requires.
SIG-002401The request timestamp is outside the allowed time window.
SIG-003401The request signature is missing or does not match.
SIG-005409This request nonce was already used.
VAL-014400The TapPay-Version header is not a known API version.
BIZ-004403The terminal is not active.
BIZ-005403The merchant account is not in a state that allows 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.
VAL-001400The request failed validation.
RFD-022409The payment is not eligible for a refund.
RFD-030422The refund amount is greater than the amount that can still be refunded.
RFD-031409No refund route is available for this payment.
RFD-032422This payment does not support partial refunds.
RFD-033422Refunds are not supported for this payment.
RFD-034422The refund window for this payment has expired.
RFD-035409This actor is not allowed to request the refund.
RFD-036409A refund with this idempotency key already exists with different parameters.
RFD-038422The refund lines are not valid for this invoice.
FSW-023409The operation cannot proceed because the funding account is missing.
PRE-005409The payment is not a pre-authorization.
PRE-006409The pre-authorization was already finalized.
PRE-007409The pre-authorization has expired and can no longer be finalized.
PRE-008422The finalize amount is not valid.
PRE-009409A finalize for this pre-authorization is already in progress.
PRE-010409The pre-authorization capture failed.
PRE-011409The pre-authorization has not been finalized yet.
curl -sS -X POST "https://api.tappay.mn/api/v1/payments/PAYMENT_ID/finalize" \
  -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 '{"amount":"900"}'
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const payment = await tappay.payments.finalize({ id: 'PAYMENT_ID', body: { amount: '900' } });
console.log(JSON.stringify(payment));
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$payment = $tappay->payments->finalize(['id' => 'PAYMENT_ID', 'body' => ['amount' => '900']]);
echo json_encode($payment);
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
payment = client.payments.finalize({"id": "PAYMENT_ID", "body": {"amount": "900"}})
print(json.dumps(payment))
{
  "success": true,
  "data": {
    "id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e04",
    "ebarimt": null,
    "intentId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e02",
    "invoiceId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e03",
    "status": "SUCCEEDED",
    "amount": 1000,
    "currency": "MNT",
    "channel": "CARD",
    "payerWallet": null,
    "sticker": null,
    "feeAmount": 15,
    "merchantNet": 985,
    "serviceFeeMerchant": 0,
    "serviceFeeCustomer": 0,
    "succeededAt": "2026-10-03T08:20:00.000Z",
    "createdAt": "2026-10-03T08:15:00.000Z",
    "fulfillment": null,
    "receipt": null,
    "authorizationType": "PREAUTH",
    "preauthMode": "CHARGE_REFUND",
    "preauthStatus": "FINALIZED",
    "finalAmount": "900",
    "finalizeDueAt": "2026-10-10T08:15:00.000Z",
    "authorizedAt": null,
    "preauthRefundId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e06",
    "paymentMethodId": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e05",
    "customer": "cust-7d2f4a91",
    "ebarimtRecipient": {
      "type": "NONE",
      "register": null,
      "tin": null,
      "email": null
    },
    "settlement": null
  }
}

For the full flow, read the guide.