# Save payment amount API

### Saves the payment amount before calling the payment window to block the payment process in case of forgery or falsification of the payment amount when making an authenticated payment.

## Saves the payment amount before calling the payment window.

<mark style="color:green;">`POST`</mark> `https://api.iamport.kr/payments/prepare`

If the payment amount of the order saved on the merchant-side is different from the amount passed to IMP.requestpay() for the same merchan&#x74;*\_*&#x75;id, the PG payment window call is blocked.

#### Request Body

| Name                                            | Type   | Description                                           |
| ----------------------------------------------- | ------ | ----------------------------------------------------- |
| merchant\_uid<mark style="color:red;">\*</mark> | String | <mark style="color:red;">**Merchant order ID**</mark> |
| amount<mark style="color:red;">\*</mark>        | double | <mark style="color:red;">**Payment amount**</mark>    |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="PaymentPrepareResponse" %}
**`code`** <mark style="color:red;">**\***</mark>**&#x20;**<mark style="color:purple;">**integer**</mark>

**Response code**

0: success, Not 0: check the message

**`message`** <mark style="color:red;">**\***</mark>**&#x20;**<mark style="color:green;">**string**</mark>

**Response message**

A non-zero code includes a message like 'Invalid payment info'.

<mark style="color:red;">**`response (PaymentPrepareAnnotation, optional)`**</mark>
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PaymentPrepareAnnotation" %}
**merchant\_uid&#x20;**<mark style="color:red;">**\***</mark>**&#x20;**<mark style="color:green;">**string**</mark>

**`Merchant order ID`**

**`amount`**<mark style="color:red;">**`*`**</mark><mark style="color:orange;">**`number`**</mark>&#x20;

**`Payment amount`**
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401: Unauthorized Missing or invalid access token" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Response Model Schema</summary>

```json
{
  "code": 0,
  "message": "string",
  "response": {
    "merchant_uid": "string",
    "amount": 0
  }
}
```

</details>

{% hint style="success" %}
**Swagger Test Link**

[**https://api.iamport.kr/#!/payments.validation/preparePayment**](https://api.iamport.kr/#!/payments.validation/preparePayment)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://portone.gitbook.io/docs-en/api/payment-api/save-payment-amount-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
