# 결제정보 사전 검증하기

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

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

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

결제정보 사전 검증은 클라이언트 변조를 원천적으로 차단하기 위한 필수 절차입니다.

결제창을 띄우는 프론트엔드를 보여주기 전에 어떤 주문번호로 얼마만큼의 결제가 이루어져야 하는지를 아래의 API를 사용하여 사전에 등록할 수 있습니다.

{% content-ref url="/pages/JrrkuFuFcdrGQSBbknEc" %}
[결제금액 사전등록 API](/docs/api/api-1/api-5.md)
{% endcontent-ref %}

{% tabs %}
{% tab title="Node.js" %}

```javascript
// 사용자에게 결제 화면을 보여주기 전에 서버 코드에서
await axios({
  url: "https://api.iamport.kr/payments/prepare",
  method: "post",
  headers: { "Content-Type": "application/json" }, 
  data: {
    merchant_uid: "...", // 가맹점 주문번호
    amount: 420000, // 결제 예정금액
  }
});
```

{% endtab %}
{% endtabs %}

`IMP.request_pay`의 인자로 들어온 금액이 위의 API로 사전 등록해둔 금액과 일치하지 않으면 SDK 수준에서 결제 요청이 차단됩니다.


---

# 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/auth/guide/5/pre.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.
