# Update a POS payment amount

> Changes the amount of an open POS payment before the customer pays.

Source: https://docs.tappay.mn/reference/pos/payments/update-amount/

Changes the amount of an open POS [payment](https://docs.tappay.mn/glossary.md#payment) before the [customer](https://docs.tappay.mn/glossary.md#customer) pays. The QR code stays the same.

`PATCH /api/pos/v1/payments/{paymentId}`

### 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 | | |

### Path parameters

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `paymentId` | string | yes | | |

### Request body

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `amount` | number | yes | | |

### Response 200

| Name | Type | Required | Values | Description |
| - | - | - | - | - |
| `payment_id` | string | yes | | |
| `qr_ref` | string \| null | yes | | |
| `pos_reference` | string | yes | | |
| `status` | string | yes | `OPEN`, `ACCEPTED`, `PAID`, `FAILED`, `SETTLED`, `PARTIALLY_REFUNDED`, `REFUNDED`, `EXPIRED` | |
| `instrument` | string \| null | yes | | |
| `qr_flow` | string \| null | yes | `MPM`, `CPM`, `null` | |
| `amount` | number | yes | | |
| `service_fee` | number \| null | yes | | |
| `total` | number | yes | | |
| `currency` | string | yes | | |
| `narrative` | string \| null | yes | | Statement narrative TapPay builds: \<terminal narrative_name> \<token> (max 50); null when the intent has no token |
| `settlement` | string \| null | yes | `SCHEDULED`, `SETTLED`, `null` | |
| `card` | object \| null | yes | | |
| `card.bin` | string \| null | yes | | |
| `card.last4` | string \| null | yes | | |
| `card.brand` | string \| null | yes | | |
| `card.auth_code` | string \| null | yes | | |
| `card.rrn` | string \| null | yes | | |
| `card.decline_code` | string \| null | yes | | |
| `failure_code` | string \| null | yes | | |
| `expires_at` | string | yes | | |
| `emvco_payload` | string | yes | | |

### Errors

| Code | Status | Message |
| - | - | - |
| [`POS-002`](https://docs.tappay.mn/errors.md#POS-002) | 401 | The POS access token is missing, invalid or expired. |
| [`POS-003`](https://docs.tappay.mn/errors.md#POS-003) | 401 | The POS API key is invalid or revoked. |
| [`POS-004`](https://docs.tappay.mn/errors.md#POS-004) | 401 | The request timestamp is outside the allowed time window. |
| [`POS-005`](https://docs.tappay.mn/errors.md#POS-005) | 401 | The request signature is invalid. |
| [`POS-006`](https://docs.tappay.mn/errors.md#POS-006) | 401 | This request signature was already used. |
| [`AUTH-055`](https://docs.tappay.mn/errors.md#AUTH-055) | 403 | The caller's scope does not allow this operation. |
| [`POS-007`](https://docs.tappay.mn/errors.md#POS-007) | 401 | A client certificate is required for this request. |
| [`VAL-002`](https://docs.tappay.mn/errors.md#VAL-002) | 400 | A required field or header is missing. |
| [`VAL-010`](https://docs.tappay.mn/errors.md#VAL-010) | 409 | This Idempotency-Key was already used with a different request body. |
| [`VAL-013`](https://docs.tappay.mn/errors.md#VAL-013) | 409 | A request with this Idempotency-Key is still being processed. |
| [`POS-091`](https://docs.tappay.mn/errors.md#POS-091) | 403 | The terminal push flow is not enabled for this POS client. |
| [`POS-016`](https://docs.tappay.mn/errors.md#POS-016) | 404 | The POS payment was not found. |
| [`PAY-012`](https://docs.tappay.mn/errors.md#PAY-012) | 409 | The payment intent is no longer open. |
| [`PAY-038`](https://docs.tappay.mn/errors.md#PAY-038) | 409 | A payment for this invoice is in progress, so it cannot be edited. |
| [`PAY-039`](https://docs.tappay.mn/errors.md#PAY-039) | 422 | Subscription invoices and payer-created intents cannot be edited. |
| [`AFP-001`](https://docs.tappay.mn/errors.md#AFP-001) | 409 | The payment intent is locked by another operation. |
| [`SET-007`](https://docs.tappay.mn/errors.md#SET-007) | 422 | The value violates a platform limit. |

```bash title="curl"
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='{"amount":1200}'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
SIG=$(printf '%s\n%s\n%s\n%s' 'PATCH' '/api/pos/v1/payments/PAYMENT_ID' "$TS" "$BODY" | openssl dgst -sha256 -hmac 'YOUR_POS_SIGNING_SECRET' | sed 's/^.* //')
curl -sS -X PATCH "https://sandbox-api.tappay.mn/api/pos/v1/payments/PAYMENT_ID" \
  -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 "Content-Type: application/json" \
  -d "$BODY"
```

```js title="Node.js"
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.updateAmount({ paymentId: 'PAYMENT_ID', body: { amount: 1200 } });
console.log(JSON.stringify(payment));
```

```php title="PHP"
<?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->updateAmount(['paymentId' => 'PAYMENT_ID', 'body' => ['amount' => 1200]]);
echo json_encode($payment);
```

```python title="Python"
import json
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.update_amount({"paymentId": "PAYMENT_ID", "body": {"amount": 1200}})
print(json.dumps(payment))
```

```json title="Response"
{
  "payment_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9e0b",
  "qr_ref": "QR-20261009-0001",
  "pos_reference": "pos-1001",
  "status": "OPEN",
  "instrument": null,
  "qr_flow": "MPM",
  "amount": 1200,
  "service_fee": null,
  "total": 1200,
  "currency": "MNT",
  "narrative": "Order #1001",
  "settlement": null,
  "card": null,
  "failure_code": null,
  "expires_at": "2026-10-09T08:15:00.000Z",
  "emvco_payload": "000201010212...6304ABCD"
}
```

For the full flow, read the [POS guide](https://docs.tappay.mn/guides/pos-terminal.md).
