개발자센터

JTNET

JTNET 결제 연동 방법을 안내합니다.

1. JTNET PG 설정하기

JTNET 설정 페이지의 내용을 참고하여 PG 설정을 진행합니다.

2. 결제 요청하기

JavaScript SDK IMP.request_pay(param, callback)을 호출하여 JTNET 결제창을 호출할 수 있습니다. 결제결과는 PC의 경우 IMP.request_pay(param, callback) 호출 후 callback 으로 수신되고 모바일의 경우 m_redirect_url 로 리디렉션됩니다.

Javascript SDK
IMP.request_pay({
  pg: "jtnet.{상점 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: "서울특별시 강남구 삼성동",
  buyer_postcode: "123-456",
  m_redirect_url: "{모바일에서 결제 완료 후 리디렉션 될 URL}" 
}, function(rsp) { // callback 로직
  /* ...중략... */
});

주요 파라미터 설명

pg *string

PG사 구분코드

jtnet 로 지정하면 됩니다.

pay_method * string

결제수단 구분코드

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

merchant_uid * string

가맹점 고유주문번호

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

amount * integer

결제금액

string 이 아닌점에 유의하세요

**인증결제창 예시**

인증결제창 호출 파라미터에서 customer_uid 값을 추가하면 비 인증 결제창을 호출할 수 있습니다.

amount 금액

  • 빌링키 발급시 amount 파라미터에 금액이 설정되는 경우 실 결제와 동시에 빌링키가 발급됩니다.
  • 실결제를 원하지 않은 경우 amount 금액을 0원으로 설정합니다.
Javascript SDK
IMP.request_pay(
  {
    pg: "jtnet.{상점 ID}",
    pay_method: "card", // 'card'만 지원됩니다.
    merchant_uid: "order_monthly_0001", // 상점에서 관리하는 주문 번호
    name: "최초인증결제",
    amount: 0, // 빌링키 발급만 진행하며 결제승인을 하지 않습니다.
    customer_uid: "your-customer-unique-id", // 필수 입력
    buyer_email: "test@portone.io",
    buyer_name: "포트원",
    buyer_tel: "02-1234-1234",
    m_redirect_url: "{모바일에서 결제 완료 후 리디렉션 될 URL}",
  },
  function (rsp) {
    if (rsp.success) {
      alert("빌링키 발급 성공");
    } else {
      alert("빌링키 발급 실패");
    }
  }
);

주요 파라미터 설명

pg * string

PG사 구분코드

jtnet 로 지정하면 됩니다.

customer_uid * string

카드 빌링키

비 인증 결제창에서 고객이 입력한 카드정보와 1:1로 매칭될 빌링키를 지정합니다.

amount * Integer

결제금액

0원으로 설정시 빌링키만 발급되며 0원 이상 설정시 실 결제와 빌링키 발급이 동시에 이루어 집니다.\

빌링키(customer_uid)로 결제 요청하기

빌링키 발급이 성공하면 실 빌링키는 customer_uid 와 1:1 매칭되어 포트원 서버에 저장됩니다. customer_uid를 가맹점 내부서버에 저장하시고 비 인증 결제요청 REST API를 호출하시면 결제를 발생시킬 수 있습니다.

server-side
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

API 방식으로 빌링키 발급,결제요청,예약결제를 구현할수 있습니다.

일회성 결제 요청하기

REST API POST /subscribe/payments/onetime을 호출하여 일회성 결제를 요청합니다. 요청 시 전달된 카드는 포트원에 등록되지 않습니다.

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/customers/{customer_uid}를 호출하여 빌링키 발급을 요청합니다.

curl -H "Content-Type: application/json" \
     -X POST -d '{"card_number":"1234-1234-1234-1234", "expiry":"2025-12", "birth":"820213", "pwd_2digit":"00"}' \
     https://api.iamport.kr/subscribe/customers/your-customer-unique-id

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

REST API POST /subscribe/payments/onetime을 호출하여 빌링키 발급과 최초 결제를 요청합니다.

  • 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) 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

자세한 가이드는 아래 링크를 참조하세요

3. 부가기능

javascript
card: {
  detail: [
    { card_code: "*", enabled: false }, // 모든 카드사 비활성화
    { card_code: '366', enabled: true }, // 특정 카드만 활성화
  ],
}

파라미터 설명

  • card_code: 금결원 카드사코드 링크 참조 (string)
  • enabled: 해당카드 활성화 여부 (boolean)