# 핵토파이낸셜

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

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

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

### 1. 핵토파이낸셜 PG 설정하기

[**핵토파이낸셜 설정**](https://portone.gitbook.io/docs/ready/2.-pg/payment-gateway/settle) 페이지의 내용을 참고하여 PG 설정을 진행합니다.

![](https://2409678497-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwWX2hlvRZLZrXeH1aacF%2Fuploads%2Fgit-blob-57a02d4cdda168573fb1ef61c63dcb8b578298a8%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202022-06-01%20%EC%98%A4%ED%9B%84%204.32.44.png?alt=media)

### 2.결제 요청하기

[JavaScript SDK](https://portone.gitbook.io/docs/sdk/javascript-sdk-old) IMP.**request\_pay**(param, callback)을 호출하여 핵토파이낸셜 결제창을 호출할 수 있습니다. **결제결과**는 PC의 경우 IMP.request\_pay(param, callback) 호출 후 <mark style="color:red;">**callback**</mark> 으로 수신되 모바일의 경우 <mark style="color:red;">**m\_redirect\_url**</mark> 로 리디렉션됩니다.

{% tabs %}
{% tab title="인증결제창 요청" %}
{% code title="Javascript SDK" %}

```javascript
IMP.request_pay({
    pg : 'settle.{상점 ID}',
    pay_method : 'card',
    merchant_uid: "order_no_0001", //상점에서 생성한 고유 주문번호
    name : '주문명:결제테스트',
    amount : 1004,
    buyer_email : 'test@portone.io',
    buyer_name : '구매자이름',
    buyer_tel : '010-1234-5678',  //누락시 오류 발생 
    buyer_addr : '서울특별시 강남구 삼성동',
    company : '포트원',  // 가상계좌 발급시 권고사항
    buyer_postcode : '123-456'
    m_redirect_url : '{모바일에서 결제 완료 후 리디렉션 될 URL}'
}, function(rsp) { // callback 로직
	//* ...중략... *//
});
```

{% endcode %}

**주요 파라미터 설명**

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

**PG사 구분코드**

**`settle`** 로 지정하면 됩니다.

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

**결제수단 구분코드**

* card (신용카드)
* trans (실시간 계좌이체)
* vbank(가상계좌)
* phone (휴대폰소액결제)

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

**`주문번호`**

매번 고유하게 채번되어야 합니다.

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

**구매자 연락처**

필수 파라미터 입니다.

**`amount`** <mark style="color:red;">**\***</mark> <mark style="color:purple;">**`integer`**</mark>

**결제금액**

<mark style="color:green;">**string**</mark> 이 아닌점에 유의하세요

**`company`** <mark style="color:green;">**`string`**</mark>

**`회사명`**

<mark style="color:red;">**가상계좌**</mark> 결제 요청인 경우 필수 파라미터

{% embed url="<https://codepen.io/chaiport/pen/GRQdjpa>" %}
세틀뱅크 카드인증결제 예제
{% endembed %}
{% endtab %}

{% tab title="비인증 결제창 요청" %}
**세틀뱅크는 비 인증 결제창을 지원하지 않습니다.**
{% endtab %}

{% tab title="비인증 API  결제요청" %}
**API 방식으로 결제요청,예약결제를 구현할수 있습니다.**

**일회성 결제 요청하기**

REST[ **API POST /subscribe/payments/onetime**](https://portone.gitbook.io/docs/api/api-4/api-1)을 호출하여 일회성 결제를 요청합니다. 요청 시 전달된 카드는 포트원에 등록되지 않습니다.

```
curl -H "Content-Type: application/json" \   
     -X POST -d '{"merchant_uid":"order_id_8237352", "card_number":"1234-1234-1234-1234", "expiry":"2019-01", "birth":"123456", "amount":3000}' \
     https://api.iamport.kr/subscribe/payments/onetime
```

**빌링키 발급 및 최초 결제 요청하기**

REST [**API POST /subscribe/payments/onetime**](https://portone.gitbook.io/docs/api/api-4/api-1)을 호출하여 빌링키 발급과 최초 결제를 요청합니다.

* **`customer_uid`** : 빌링키 등록을 위해서 지정해야 합니다.

```
curl -H "Content-Type: application/json" \   
     -X POST -d '{"customer_uid":"your-customer-unique-id", "merchant_uid":"order_id_8237352", "card_number":"1234-1234-1234-1234", "expiry":"2019-01", "birth":"123456", "amount":3000}' \
     https://api.iamport.kr/subscribe/payments/onetime 
```

**빌링키로 결제 요청하기**

빌링키 발급과 최초 결제가 성공하면 빌링키는 전달된 `customer_uid` 와 1:1 매칭되어 포트원에 저장됩니다. 보안상의 이유로 서버는 빌링키에 직접 접근할 수 없기 때문에 `customer_uid`를 이용해서 재결제([**POST /subscribe/payments/again**](https://portone.gitbook.io/docs/api/api-4/api)) REST API를 다음과 같이 호출합니다.

```
curl -H "Content-Type: application/json" \   
     -X POST -d '{"customer_uid":"your-customer-unique-id", "merchant_uid":"order_id_8237352", "amount":3000}' \
     https://api.iamport.kr/subscribe/payments/again
```

{% hint style="info" %}
**세틀뱅크는** [**빌링키 단독 발급 API**](https://portone.gitbook.io/docs/api/api-2/api-1)**가 지원되지 않습니다.**
{% endhint %}

**자세한 비 인증 결제 가이드는 아래 링크를 참조하세요**

{% content-ref url="../../auth/guide-1" %}
[guide-1](https://portone.gitbook.io/docs/auth/guide-1)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
