가상계좌 발급 API
해당 페이지는 NHN KCP 가상계좌 발급 요청 및 응답에 대해 설명합니다.
KCP 가상계좌 서비스는 결제창 UI 없이 API 전문 통신 방식으로 제공됩니다.
가맹점 서버에서 주문·입금 정보를 전송하면 고객이 입금할 수 있는 일회성 가상계좌번호를 발급받을 수 있습니다.
가상계좌 발급 응답은 결제 완료가 아닌 계좌 발급 완료 상태이므로, 실제 결제 처리는 추후 입금 통보 데이터를 기준으로 진행하세요.
요약
HTTP Method
POST 방식으로 JSON Body를 전송합니다.
Content-Type
application/json; charset=utf-8 형식으로 요청합니다.
통신 보안
TLS 1.2 이상 환경에서 통신합니다.
테스트 URL
https://stg-spl.kcp.co.kr/gw/hub/v1/payment
운영 URL
https://spl.kcp.co.kr/gw/hub/v1/payment
정상 응답 기준
res_cd 값이 V000이면 가상계좌 발급이 정상 처리된 상태입니다.
요청 정보
Request Body 예시
{
"site_cd": "T0000",
"kcp_cert_info": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----",
"pay_method": "VCNT",
"amount": "1004",
"currency": "410",
"ordr_idxx": "TEST1234567890",
"good_name": "테스트상품",
"buyr_name": "홍길동",
"buyr_tel2": "010-1234-1234",
"buyr_mail": "test@your-shop.example.com",
"va_txtype": "41100000",
"va_mny": "1004",
"va_bankcode": "BK26",
"va_name": "홍길동",
"va_date": "20261231235959",
"va_receipt_gubn": "0",
"va_taxno": "01012341234"
} 요청 파라미터
파트너관리자 인증센터에서 다운로드한 PEM 파일 내용을 직렬화하여 사용합니다.ex) kcp_cert_info: -----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
가상계좌 은행코드
가상계좌 발급 요청의 va_bankcode에 사용하는 코드입니다. 제공 은행은 변경될 수 있습니다.
| 은행명 | 은행코드 | 은행명 | 은행코드 |
|---|---|---|---|
| 기업은행 | BK03 | iM뱅크 | BK31 |
| 국민은행 | BK04 | 부산은행 | BK32 |
| 수협 | BK07 | 광주은행 | BK34 |
| 농협 | BK11 | 경남은행 | BK39 |
| 우리은행 | BK20 | 우체국 | BK71 |
| SC제일은행 | BK23 | KEB하나은행 | BK81 |
| 신한은행 | BK26 | - | - |
응답 정보
가상계좌 발급은 결제 완료가 아닙니다. 고객의 실제 입금 여부는 입금 통보 데이터로 확인하고 결제 상태를 변경하세요.
발급 실패 시에는 res_cd, res_msg, res_en_msg 외의 발급 상세정보가 리턴되지 않습니다.
Response Body 예시
{
"res_cd": "V000",
"res_msg": "가상계좌가 발급되었습니다.",
"res_en_msg": "The virtual account is issued.",
"pay_method": "PAVC",
"tno": "20260715435727",
"order_no": "TEST1234567890",
"amount": "1004",
"account": "T2609260001713",
"bankname": "신한은행",
"bankcode": "BK26",
"depositor": "NHN KCP",
"app_time": "20260715120000",
"va_date": "20261231235959"
} 응답 파라미터
구현 참고사항
첨부한 JSP 샘플의 JSON 요청 전문 구성과 HTTPS 호출 방식을 기준으로 작성했습니다.
JSP 샘플 구현 포인트 보기
가맹점 서버에서 JSONObject로 요청 전문을 구성하고 HttpURLConnection으로 API를 호출합니다. 서비스 인증서는 클라이언트에 노출하지 말고 서버에서 직렬화하여 요청하세요.
// 가상계좌 발급 API URL String target_URL = "https://stg-spl.kcp.co.kr/gw/hub/v1/payment"; // 운영: https://spl.kcp.co.kr/gw/hub/v1/payment JSONObject json_req = new JSONObject(); json_req.put("site_cd", "T0000"); json_req.put("kcp_cert_info", kcp_cert_info); json_req.put("pay_method", "VCNT"); json_req.put("amount", "1004"); json_req.put("currency", "410"); json_req.put("ordr_idxx", "TEST1234567890"); json_req.put("good_name", "테스트상품"); json_req.put("buyr_name", "홍길동"); json_req.put("buyr_tel2", "010-1234-1234"); json_req.put("buyr_mail", "test@your-shop.example.com"); json_req.put("va_txtype", "41100000"); json_req.put("va_mny", "1004"); json_req.put("va_bankcode", "BK26"); json_req.put("va_name", "홍길동"); json_req.put("va_date", "20261231235959"); json_req.put("va_receipt_gubn", "0"); json_req.put("va_taxno", "01012341234"); String req_data = json_req.toString(); StringBuffer outResult = new StringBuffer(); URL url = new URL(target_URL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json; charset=utf-8"); conn.setRequestProperty("Accept-Charset", "UTF-8"); try (OutputStream os = conn.getOutputStream()) { os.write(req_data.getBytes(StandardCharsets.UTF_8)); os.flush(); } try (BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { String inputLine; while ((inputLine = in.readLine()) != null) { outResult.append(inputLine); } } conn.disconnect(); String res_data = outResult.toString(); JSONObject json_res = (JSONObject) new JSONParser().parse(res_data); String res_cd = (String) json_res.get("res_cd"); // 가상계좌 발급 정상 처리 if ("V000".equals(res_cd)) { String tno = (String) json_res.get("tno"); String account = (String) json_res.get("account"); String bankcode = (String) json_res.get("bankcode"); String amount = (String) json_res.get("amount"); // tno, account, bankcode, amount를 가맹점 서버에 저장 // 결제 완료 처리는 추후 입금 통보 데이터 수신 후 진행 }