# 결제금액 사전등록 API

{% hint style="warning" %}
**Deprecated**

이 문서는 더 이상 관리되지 않습니다.

[PortOne 개발자센터](https://developers.portone.io/)를 이용해주세요.
{% endhint %}

### 인증결제를 진행할 때 결제금액 위변조 시 결제진행자체를 block 하기 위해 결제예정금액을 사전등록하는 기능

## 결제 금액을 사전 등록합니다.

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

사전등록된 가맹점 주문번호(merchant\_uid)에 대해, IMP.request\_pay()에 전달된 merchant\_uid가 일치하는 주문의 결제금액이 다른 경우 PG사 결제창 호출이 중단됩니다

#### Request Body

| Name                                            | Type   | Description                                  |
| ----------------------------------------------- | ------ | -------------------------------------------- |
| merchant\_uid<mark style="color:red;">\*</mark> | String | <mark style="color:red;">**가맹점 주문번호**</mark> |
| amount<mark style="color:red;">\*</mark>        | double | <mark style="color:red;">**결제 예정금액**</mark>  |

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

**응답코드**

0이면 정상적인 조회, 0 이 아닌 값이면 message를 확인해봐야 합니다

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

**응답메세지**

code 값이 0이 아닐 때, '존재하지 않는 결제정보입니다'와 같은 오류 메세지를 포함합니다

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

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

**가맹점 주문번호**

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

**`결제 예정 금액`**
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401: Unauthorized 인증 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 %}
