NAV Navbar
  • Online APIs
  • OverView
  • Payment APIs
  • Merchant provided API or Page
  • Appendix
  • Online APIs

    OverView

    LINE Pay

    LINE Pay는 LINE 회원들이 LINE Pay 가맹점 사이트에서 사용할 수 있는 결제 시스템이다.

    Payment process 라인페이 결제 과정

    가맹점이 LINE Pay 가맹점으로 가입하면 LINE을 사용하고 있는 전 세계의 LINE 회원들을 가맹점의 고객으로 유치할 수 있다. 또한 LINE을 통해 가맹점의 마케팅 채널을 확장하여 매출 향상을 기대할 수 있다. LINE Pay를 사용하는 가입자들이 LINE Pay로 결제하려면, 결제하려는 사이트가 반드시 LINE Pay 가맹점으로 등록되어 있어야 한다.

    LINE Pay 가맹점 등록 과정

    LINE Pay 가맹점으로 등록하면 연동을 위한 "Channel Id"와 "Channel SecretKey"가 Sandbox, Production용으로 각각 발급된다. 가맹점 등록 과정은 다음과 같다.

    Kr register merchant

    가맹점 등록 과정

    1. 신청 페이지(https://pay.line.me) 접속
    2. 기본 정보 작성 및 필수 서류 제출
    3. 가맹점 등록 심사
    4. 수수료 및 정산 주기 사용 동의, 본인 확인 PIN 입력
    5. 가맹점 등록 완료
    6. 등록 완료 메일 발송

    일반결제

    LINE Pay 회원은 LINE Pay 결제 화면에서 결제 수단(잔고, 신용카드, 은행계좌, LINE 포인트)을 선택하고 결제정보를 passcode로 인증합니다. "Request API"로 전달한 가맹점의 "confirmUrl"로 화면 이동하고 가맹점 서버는 결제 "Confirm API"로 결제를 완료한다.

    PC인 경우

    Pc payment reserve complete

    PC 결제 화면-결제 완료

    1. LINE Pay 회원은 LINE App 결제 화면에서 결제 수단을 선택하고 비밀번호를 입력한다.
    2. LINE Pay Server는 결제를 위한 결제 수단 정보를 저장하고, 결제 상태 정보를 결제 가능한 상태로 변경한다.
    3. LINE Pay 회원은 LINE App에서 결제승인 정보 화면을 확인한다.
    4. 결제 대기 화면은 주기적으로 결제 가능한 상태를 확인한다. 결제 가능 상태가 되면 결제요청 시 전달한 "confirmUrl"로 이동한다.
    5. 가맹점은 LINE Pay Server로 결제 Confirm API를 호출하여 결제를 완료한다

    모바일인 경우

    Mobile payment reserve complete

    모바일 결제 화면-결제 완료

    1. LINE Pay 회원은 LINE App 결제 화면에서 결제 수단을 선택하고 비밀번호를 입력한다.
    2. LINE Pay Server는 결제를 위한 결제 수단 정보를 저장하고 결제 상태 정보를 결제 가능한 상태로 변경한다.
    3. LINE Pay 회원은 LINE app에서 결제 정보 화면을 확인한다. 화면 하단의 확인 버튼을 눌러 결제요청 시 전달받은 "confirmUrl"로 이동한다.
    4. 가맹점은 LINE Pay로 결제 Confirm API를 호출하여 결제를 완료한다.

    인증과 매입이 분리

    일반결제와 동일하지만 Confirm API로 결제 확정시, 결제 상태가 매입대기 상태로 완료된다. LINE Pay는 인증 만료일까지 매입 대기 상태를 유지하고, 인증만료일 이전에 가맹점은 "매입"(Capture API)과정을 통해 결제상태를 매입상태로 변경한다.

    confirmUrl의 Server-to-Server

    일반 결제에서는 confirmUrl은 가맹점에게 사용자의 결제승인 완료의 알리고 사용자에게는 결제완료 화면으로 이동하는 페이지 기능을 제공한다. 하지만 사용자에게 결제완료 화면을 보여줄 필요가 없을 경우는 redirectUrls.confirmUrlType을 "SERVER"로 설정하여 페이지도 이동없이 LINE Pay Server에서 confirmUrl을 요청하여 결제 승인을 알린다. 사용자 결제승인 후 가맹점 서버와 LINE Pay 서버 간의 Confirm API로 결제 완료 과정을 진행한다. 연동 흐름은 아래와 같다.

    Send confirm url server to server

    confirmUrl을 Server-to-Server로 전달

    1. 가맹점은 결제 Request API의 redirectUrls.confirmUrlType : "SERVER"로 설정한다.
    2. LINE Pay 회원은 LINE Pay 결제 화면 진입 후 결제 수단을 선택하고 비밀번호를 입력한다.
    3. LINE Pay 서버는 결제 정보를 저장하고, 결제요청 시 가맹점이 전달한 confirmUrl을 호출한다.
    4. 가맹점 서버는 결제 confirm API를 호출하여 결제를 완료한다. confirmUrl에 대한 응답이 정상적으로 전달되지 않은 경우에는 confirm API를 호출할 수 없다.

    [Merchant API] confirmUrl

    연관 API

    Checkout (Only Japan)

    LINE Pay에서 제공하는 다양한 결제수단(잔고, 신용카드, 은행계좌, LINE Point)과 LINE 회원 정보를 활용하여 결제와 주문을 간편하게 이용할 수 있다.

    Checkout Flow

    Kr checkout flow

    Checkout flow

    1. LINE Pay의 Request API로 결제정보를 요청한다. 결제 요청시 Checkout 서비스 활성화를 하기 위해 "shipping.type"은 SHIPPING을 설정하고 배송수단과 배송비를 조회할 수 있는 Inquiry ShippingMethods API를 구현하여 API Url을 "shipping.feeInquiryUrl"을 담아 LINE Pay에 제공한다.
    2. 결제요청 API의 응답정보의 paymentUrl로 LINE Pay 결제화면으로 이동할 수 있다.
    3. LINE 회원은 LINE app 결제 화면에서 결제 상품과 결제정보를 확인하고 배송지를 입력한다. 배송지가 선택되면 LINE Pay는 배송지와 주문정보(orderId, transactionId)로 가맹점의 사용가능한 배송수단을 조회하여 사용자가 배송수단을 선택할 수 있도록 구성한다.
    4. 사용자는 배송수단, 결제수단 선택하고 안전하고 간편한 LINE Pay 사용자 인증을 통해 결제요청을 승인을 한다.
    5. 사용자의 결제요청 승인이 완료되면 결제요청시 가맹점에서 제공한 confirmUrl에 배송비, 선택한 배송수단 정보를 추가하여 사용자 단말에서 "confirmUrl"로 이동한다.
    6. 결제요청의 승인이 완료되어 결제 완료 가능함을 confirmUrl로 가맹점에 전달한다. confirmUrl이 호출된 결제요청은 가맹점에서 Confirm API를 호출하여 결제를 완료한다.

    Checkout 타입

    LINE Pay에서는 "shipping.type" 옵션으로 Checkout과 일반결제 기능을 제공합니다. Checkout 기능을 사용자에게 제공하려면 Checkout 옵션은 SHIPPING으로 설정합니다. 일반 결제를 제공하려면 옵션을 NO_SHIPPING으로 설정합니다. 기본값은 NO_SHIPPING입니다.

    Highly Recommand

    배송수단

    LINE Pay 사용자가 배송지를 입력하면 결제한 주문에서 배송 가능한 배송업체와 배송비, 예정된 배달기간을 리스트 제공해야 한다. 제공되어야할 API의 자세한 정보는 Inquiry ShippingMethods API에서 확인할 수 있다.

    Checkout 화면에서 사용자가 배송지를 선택하게 되면 지역에 대한 배송 정보를 LINE Pay에서 가맹점으로 요청하게 됩니다. 선택된 배송수단과 배송비는 confirmUrl의 Query String로 전달됩니다. 자세한 내용은 confirmUrl Spec 참고하세요.

    일반적인 Checkout은 "shipping.feeInquiryType"을 CONDITION을 사용하며 배송지에 따라 변동되는 배송비, 배송정보를 지원합니다. 상품이나 주문의 배송비가 고정 또는 무료인 상품은 FIXED를 선택할 수 있습니다. FIXED의 동작은 LINE Pay Checkout의 배송지 정보 사용과 결제 완료시 가맹점에게 주만 배송지 정보가 제공되지만 LINE Pay에서 주문의 배송수단 조회를 하지 않습니다.

    Highly Recommand

    배송 수령인

    Only Japan

    수령인 정보의 firstName, lastName은 한문 이름을 사용해야 하며, firstNameOptional, lastNameOptional은 가타카나의 이름을 사용한다.

    연관 API

    자동결제

    자동 결제는 가맹점이 결제가 필요한 시점에 LINE Pay 회원의 추가 승인없이 가맹점 서버와 LINE Pay 서버 간에 자동결제 API를 통해 결제하는 기능이다. LINE Pay 회원이 최초 결제(일반결제 과정과 동일) 과정을 통해 가맹점은 "RegKey"(자동결제을 위한 키)를 발급받는다. 가맹점은 결제 "Confirm API"로 전달된 RegKey를 발급, 관리하여 이후 LINE Pay App내 사용자 승인 과정없이 "자동 결제 API"로 결제를 완료 한다.

    1. 최초 결제 및 RegKey(자동 결제를 위한 키) 발급
      1. 가맹점 서버에서 결제 Request API 호출(요청 정보 중 "options.payment.payType" : "PREAPPROVED")
      2. LINE Pay 결제 화면에서 결제 수단 및 결제 비밀번호 확인 후 redirectUrls.confirmUrl(결제 Request API 파라미터)로 이동
      3. 가맹점 서버에서 결제 "Confirm API"의 응답으로 발급된 "RegKey"를 관리
      4. 거래 완료
    1. 자동 결제
      1. RegKey로 자동 결제 API 호출
      2. 거래 완료

    Preapproved payment

    자동 결제

    1. 자동 결제 중단을 위한 RegKey 만료 요청
      1. 만료할 RegKey는 Expire RegKey API 호출
      2. 자동결제키(RegKey) 만료

    연관 API

    Payment APIs

    Infra and Tech Support

    기술 지원이나 Internal Errors, Infra의 질문은 email(pay_tech@linecorp.com)을 통해 연락 가능합니다.

    Environment URL Description
    Sandbox https://sandbox-api-pay.line.me Environment for integration testing. You can process the payment by Sandbox’s web simulation payment page instead of LINE Pay app.
    Production https://api-pay.line.me Real Service Environment

    API Authentication

    LINE Pay Payment API의 사용자 인증 방식을 설명한다. 인증에 필요한 "Channel ID"와 "Channel SecretKey" 정보는 가맹점 심사가 완료된 이후 가맹점 센터(https://pay.line.me)를 통해 확인할 수 있다. LINE Pay는 연동 준비를 위한 Sandbox 환경이 제공된다. Sandbox에서 사용 가능한 Test Channel 정보(id, secretKey)와 Production 환경에 사용하는 실제 Channel정보(id, secretKey) 모두 가맹점 센터에서 확인 가능하다.

    Hmac Signature

    HTTP Method : GET

    Signature = Base64(HMAC-SHA256(Your ChannelSecret, (Your ChannelSecret + URL Path + Query String + nonce))) Query String : ? 제외한 Query String (예시 : Name1=Value1&Name2=Value2...)

    HTTP Method : POST

    Signature = Base64(HMAC-SHA256(Your ChannelSecret, (Your ChannelSecret + URL Path + RequestBody + nonce)))

    Common Http Request Header

    LINE Pay APIs 인증의 공통 Header의 자세한 설명입니다. 인증을 위한 Http Header 정보는 아래 표와 같습니다. X-LINE-ChannelId는 "Channel Id"이고 "Channel SecretKey"로 생성한 Signature 정보는 X-LINE-Authorization에 설정합니다. X-LINE-Authorization-Nonce는 동일한 Signature을 막기위해 일회성 값을 무작위로 생성하여 사용해야 합니다.

    Key Data Type Required Description
    Content-Type String Y application/json
    X-LINE-ChannelId String Y Payment Integration Information - Channel ID
    X-LINE-MerchantDeviceProfileId String N Offline Support - Device Type
    X-LINE-Authorization-Nonce String Y UUID or Request timestamp
    X-LINE-Authorization String Y HMAC Base64 Signature

    X-LINE-Authorization-Nonce

    HMAC Signature 생성시 일회성 Random 값인 nonce를 이용하여 동일한 Signature 생성을 차단하여 악의적인 목적으로 계속 동일한 요청을 보내는 것을 막을수 있습니다. 일회성 nonce는 UUID 1 or 4나 timestamp를 이용할 수 있다.

    Nonce 생성

    
        String nonce = UUID.randomUUID().toString();
    
    

    Sample

    HMAC Sample Code

    import java.util.UUID;
    
    import org.apache.commons.codec.binary.Base64;
    import org.apache.commons.codec.digest.HmacUtils;
    
    public final class HmacSignature {
    
        private HmacSignature(){}
    
        public static String encrypt(final String keys, final String data) {
            return toBase64String(HmacUtils.getHmacSha256(keys.getBytes()).doFinal(data.getBytes()));
        }
    
        public static String toBase64String(byte[] bytes) {
            byte[] byteArray = Base64.encodeBase64(bytes);
            return new String(byteArray);
        }
    
        public static void main(String[] args) {
            CheckoutPaymentRequestForm form = new CheckoutPaymentRequestForm();
    
    
            form.setAmount(new BigDecimal("100"));
            form.setCurrency("JPY");
            form.setOrderId("merchant_order_id");
    
            ProductPackageForm productPackageForm = new ProductPackageForm();
            productPackageForm.setId("package_id");
            productPackageForm.setName("shop_name");
            productPackageForm.setAmount(new BigDecimal("100"));
    
            ProductForm productForm = new ProductForm();
            productForm.setId("product_id");
            productForm.setName("product_name");
            productForm.setImageUrl("");
            productForm.setQuantity(new BigDecimal("10"));
            productForm.setPrice(new BigDecimal("10"));
            productPackageForm.setProducts(Lists.newArrayList(productForm));
    
            form.setPackages(Lists.newArrayList(productPackageForm));
            RedirectUrls redirectUrls = new RedirectUrls();
            redirectUrls.setAppPackageName("");
            redirectUrls.setConfirmUrl("");
            form.setRedirectUrls(redirectUrls);
    
            String ChannelSecret = "a917ab6a2367b536f8e5a6e2977e06f4";
            String requestUri = "/v3/payments/request";
            String nonce = UUID.randomUUID().toString();
            String signature = encrypt(ChannelSecret, ChannelSecret + requestUri + toJson(form) + nonce);
        }
    }
    

    Request API

    결제 정보를 LINE Pay 요청한다. 사용자가 결제할 주문정보와 다양한 결제 방법을 설정할 수 있습니다. 요청이 성공하면 LINE Pay 거래번호가 발급되고 이 거래번호로 결제 완료와 환불을 할 수 있습니다.

    API Spec

    POST /v3/payments/request

    Request

    Request Body

    항목 데이터 타입 길이 필수 여부 설명
    amount Number Y 결제금액
    = sum(packages[].amount) + sum(packages[].userFee) + options.shipping.feeAmount
    currency String 3 Y 결제통화 (ISO 4217)
  • 지원 가능 통화 : USD, JPY, TWD, THB
  • orderId String 100 Y 가맹점의 결제요청건의 주문번호
  • 가맹점 관리되는 Unique Id
  • packages[].id String 50 Y 배송 단위 Package list의 Unique Id
    packages[].amount Number Y 배송단위 총 상품금액
    =sum(products[].quantity * products[].price)
    packages[].userFee Number N 사용자 수수료 : 결제 금액내에 수수료 항목이 존재하는 경우 설정
    packages[].name String 100 N 배송 단위 이름 or (내부 Shop Name)
    packages[].products[].id String 50 N 가맹점 판매상품의 Id
    packages[].products[].name String 4000 Y 판매상품명
    packages[].products[].imageUrl String 500 N 판매상품 Image Url
    packages[].products[].quantity Number Y 상품갯수
    packages[].products[].price Number Y 상품별 결제금액
    packages[].products[].originalPrice Number N 상품별 원 금액
    redirectUrls.appPackageName String 4000 N Android에서 앱 간 전환 시, phishing 방지용 정보
    redirectUrls.confirmUrl String 500 Y 사용자가 결제요청의 인증 후에 이동하는 가맹점 url
    redirectUrls.confirmUrlType String N 사용자가 결제요청의 인증 후에 confirmUrl 이동 유형
    redirectUrls.cancelUrl String 500 Y LINE 앱 결제 화면에서 LINE Pay회원이 결제를 취소하면 이동하는 URL
    options.payment.capture Boolean N 자동매입 여부
  • true : Confirm API로 인증/매입을 동시에 처리
  • false : Confirm API로 인증, Capture API로 매입처리가 필요하다
  • options.payment.payType String N 결제 유형
  • NORMAL
  • PREAPPROVED
  • options.display.locale String N 결제 대기화면의 언어 코드, 기본 언어코드는 영어(en)
  • 지원언어 : en, ja, ko, th, zh_TW, zh_CN
  • options.display.checkConfirmUrlBrowser Boolean N confirmUrl로 이동시, 사용되는browser의 체크 여부
  • true : 결제요청한 browser와 confirmUrl이 이동하는 browser가 다르면 LINE Pay 결제요청한 Browser로 이동하도록 안내
  • false : Browser 확인 없이 바로 confirmUrl로 이동
  • options.shipping.type String N 배송지 선택 타입
  • NO_SHIPPING
  • FIXED_ADDRESS
  • SHIPPING
  • options.shipping.feeAmount String N 배송비
    options.shipping.feeInquiryUrl String 500 N 배송수단 조회 url
    options.shipping.feeInquiryType String N 배송비 조회 유형
  • CONDITION : 배송지 변경시 배송수단(배송비) 조회
  • FIXED : 고정값으로 배송지 변경해도 배송수단 조회하지 않는다.
  • options.shipping.address.country String 2 N 배송지 국가
    options.shipping.address.postalCode String 10 N 배송지 우편번호
    options.shipping.address.state String 100 N 배송지 지역
    options.shipping.address.city String 100 N 배송지 주소
    options.shipping.address.detail String 1000 N 배송지 상세
    options.shipping.address.optional String 1000 N 배송지 상세 추가정보
    options.shipping.address.recipient.firstName String 200 N 수령인 이름
    options.shipping.address.recipient.lastName String 200 N 수령인 성
    options.shipping.address.recipient.firstNameOptional String 200 N 수령인 이름 추가정보
    options.shipping.address.recipient.lastNameOptional String 200 N 수령인 성 추가정보
    options.shipping.address.recipient.email String 100 N 수령인 Email
    options.shipping.address.recipient.phoneNo String 100 N 수령인 전화번호
    options.familyService.addFriends[].type String N 친구 추가 목록 서비스 타입
  • lineAt
  • options.familyService.addFriends[].idList[] List N 서비스 타입별 id list
    options.extra.branchName String 200 N 결제를 요청하는 지점명. (100 자 넘어서면 100 자만 표현됨)
    options.extra.branchId String 32 N 결제를 요청한 지점ID
    알파벳, 숫자, 특수문자 입력가능하다.

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 300 결과메세지
    info.transactionId Number 19  거래번호
    info.paymentAccessToken String 12 LINE Pay app 에서 Scanner를 이용하는 대신 코드를 입력하는 경우 사용하는 코드 값
    info.paymentUrl.app String 300 결제 화면 이동 App URL
  • 앱에서 결제 요청이 앱에서 이루어진 경우 사용
  • 가맹점 앱에서 LINE pay 앱으로 이동하기 위한 URL
  • info.paymentUrl.web String 300 결제 화면 이동 Web URL
  • 결제 요청이 웹 환경에서 이루어진 경우 사용
  • LINE Pay 결제 대기 화면으로 이동하기 위한 URL
  • 별도의 파라미터 없이 전달된 URL 그대로 이동
  • Desktop에서 팝업 open시, 사이즈 Width: 700px, Height : 546px
  • Return Codes

    Code Description
    0000 Success.
    1104 Merchant not found.
    1105 This Merchant cannot use LINE Pay.
    1106 Header information error.
    1124 Error in Amount info.
    1145 Payment in progress.
    1172 Existing same orderId.
    1178 Unsupported currency.
    1183 Payment amount must be less than 0.
    1194 This Merchant cannot use Preapproved Payment.
    2101 Parameter error.
    2102 JSON data format error
    9000 Internal error

    Request Details

    Product

    배송단위와 개별 상품별로 풍부한 주문(결제) 정보 구성이 가능합니다. Package는 배송단위를 뜻하며 Package는 여러 상품을 구성할 수 있습니다.

    RedirectUrls.confirmUrl

    사용자가 결제요청을 승인 후 confirmUrl을 자동으로 호출합니다. confirmUrl 호출은 사용자의 승인이 완료되어 Confirm API로 결제 완료가 가능한 상태를 가맹점에 알려주며 결제 승인 ~ 결제 완료 사이의 사용자에게 결제 진행 상태를 제공하는 화면을 포함해야 합니다.

    RedirectUrls.cancelUrl

    LINE Pay 결제 도중 사용자가 결제를 취소하면 Request API로 전달된 cancelUrl를 이용하여 결제취소 페이지로 이동합니다. 이때도 transactionId, orderId이 추가되어 전달됩니다.

    confirmUrlType

    사용자가 결제요청의 승인 완료 후 confirmUrl 이동 유형

    Options

    LINE Pay에서 다양한 결제 방법과 Family Services의 부가 기능을 제공합니다. Options의 필드 설정을 통해 이용할 수 있습니다.

    Payment

    결제 옵션을 설정합니다.

    payType

    일반 결제

    자동 결제

    Display

    사용자의 결제 화면과 사용자의 결제 Flow의 설정 제공한다.

    locale

    사용자의 결제 대기화면의 언어

    FamilyService

    LINE Family service의 지원 항목을 기술합니다.

    addFriends

    LINE@ 친구 추가 기능을 제공한다.

    Example

    
    {
        "options" : {
            "addFriends": [{
                "type": "lineAt",
                "idList": ["@linepay", "@checkout"]
            }]
        }
    }
    
    

    가맹점 LINE 계정과 LINE Pay 회원간 친구 추가 기능을 제공한다.

    Sample

    일반결제

    
    {
        "amount" : 100,
        "currency" : "JPY",
        "orderId" : "MKSI_S_20180904_1000001",
        "packages" : [
            {
                "id" : "1",
                "amount": 100,
                "products" : [
                    {
                        "id" : "PEN-B-001",
                        "name" : "Pen Brown",
                        "imageUrl" : "https://pay-store.line.com/images/pen_brown.jpg",
                        "quantity" : 2,
                        "price" : 50
                    }
                ]
            }
        ],
        "redirectUrls" : {
            "confirmUrl" : "https://pay-store.line.com/order/payment/authorize",
            "cancelUrl" : "https://pay-store.line.com/order/payment/cancel"
        }
    }
    
    
    

    Checkout 결제

    
    {
        "amount" : 1000,
        "currency" : "JPY",
        "orderId" : "MKSI_M_20180904_1000001",
        "packages" : [
            {
                "id" : "1",
                "amount" : 1000,
                "products" : [
                    {
                        "id" : "PEN-B-001",
                        "name" : "Pen Brown",
                        "imageUrl" : "http://pay-store.line.com/static/img/brown-head.jpg",
                        "quantity" : 2,
                        "price" : 50
                    },
                    {
                        "id" : "NT-W-001",
                        "name" : "White Note",
                        "imageUrl" : "http://pay-store.line.com/static/img/white-head.jpg",
                        "quantity" : 1,
                        "price" : 300
                    },
                    {
                        "id" : "NT-P-001",
                        "name" : "Gun mksi-edition",
                        "imageUrl" : "http://pay-store.line.com/static/img/mksi-shot.jpg",
                        "quantity" : 2,
                        "price" : 300
                    }
                ]
            }
        ],
        "redirectUrls" : {
            "confirmUrl" : "http://pay-store.line.com/payment/redirect?type=confirm",
            "cancelUrl" : "http://pay-store.line.com/payment/redirect?type=cancel"
        },
        "options" : {
            "shipping" : {
                "type" : "SHIPPING",
                "feeInquiryUrl" : "https://pay-store.line.com/order/shipping/method",
                "feeInquiryType" : "CONDITION"
            }
        }
    }
    
    
    

    자동결제

    
    {
        "amount" : 0,
        "currency" : "JPY",
        "orderId" : "MKSI_P_20181231_1000001",
        "packages" : [
            {
                "id" : "1",
                "amount": 0,
                "products" : [
                    {
                        "id" : "1",
                        "name" : "Prime MemberShip",
                        "imageUrl" : "https://pay-store.line.com/images/pen_brown.jpg",
                        "quantity" : 1,
                        "price" : 0
                    }
                ]
            }
        ],
        "redirectUrls" : {
            "confirmUrl" : "https://pay-store.line.com/order/payment/authorize",
            "cancelUrl" : "https://pay-store.line.com/order/payment/cancel"
        },
        "options" : {
            "payment" : {
                "payType" : "PREAPPROVED"
            }
        }
    }
    
    
    

    Confirm API

    confirmUrl 또는 Check Payment Status API로 결제요청이 사용자 승인 완료되면 가맹점에서 결제 완료하기 위한 API입니다. Request API의 "options.payment.capture"를 false로 설정되어 인증, 매입이 분리된 결제는 결제완료되어도 거래상태는 매입대기(인증)입니다. 매입을 위해서는 Capture API를 통해 추가적으로 매입 과정이 필요합니다.

    API Spec

    POST /v3/payments/{transactionId}/confirm

    Request Body

    항목 데이터 타입 길이 필수 여부 설명
    amount number Y 결제 금액
    currency String 3 Y 결제 통화(ISO 4217)
    지원 가능한 통화는 아래와 같다.
    • USD
    • JPY
    • TWD
    • THB

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 300 결과메세지
    info.orderId String 100 결제 요청시 전달한 가맹점 Unique 주문번호
    info.transactionId Number 결제 요청 결과로 전달받은 거래 번호(19자리)
    info.authorizationExpireDate String 30 opt-인증 만료 일시(ISO 8601)
    • 인증(capture=false)만 한 결제 건인 경우 전달
    info.regKey String 15 opt-자동 결제를 위한 키(15자리)
    info.payInfo[].method String 20 결제 시 사용된 결제 수단
    • 신용카드: CREDIT_CARD
    • 잔고: BALANCE
    • 할인: DISCOUNT
    info.payInfo[].amount Number 결제 금액
    info.payInfo[].creditCardNickname String 100 opt-자동 결제 시의 신용카드 별명
    • LINE Pay에서 관리하는 신용카드 이름. 등록 시에 설정한 이름이다.
    • LINE Pay 회원이 별명을 설정하지 않은 경우 빈 문자열이 전달된다.
    • LINE Pay에서 회원의 요청으로 변경 가능하며, 변경 내용은 가맹점에 공유되지 않는다.
    info.payInfo[].creditCardBrand String 20 opt-자동 결제 시의 신용카드 브랜드
    • VISA
    • MASTER
    • AMEX
    • DINERS
    • JCB
    info.payInfo[].maskedCreditCardNumber String 17 마스킹된 신용카드 번호(대만 가맹점인 경우만 전달, 가맹점 센터 관리자에게 요청시 기능 사용가능)
  • Format: **** **** **** 1234
  • info.packages[].id String 50 배송 단위 Package list의 Unique Id
    info.packages[].amount Number 배송단위 총 상품금액
    =sum(products[].quantity * products[].price)
    info.packages[].userFeeAmount Number 사용자 수수료 : 결제 금액내에 수수료 항목이 존재시 응답
    info.shipping.methodId String 50 사용자가 선택한 배송수단 ID
    info.shipping.feeAmount Number 배송비
    info.shipping.address.country String 2 배송지 국가
    info.shipping.address.postalCode String 10 배송지 우편번호
    info.shipping.address.state String 100 배송지 지역
    info.shipping.address.city String 100 배송지 주소
    info.shipping.address.detail String 1000 배송지 상세
    info.shipping.address.optional String 1000 배송지 상세 추가정보
    info.shipping.address.recipient.firstName String 200 수령인 이름
    info.shipping.address.recipient.lastName String 200 수령인 성
    info.shipping.address.recipient.firstNameOptional String 200 수령인 이름 추가정보
    info.shipping.address.recipient.lastNameOptional String 200 수령인 성 추가정보
    info.shipping.address.recipient.email String 100 수령인 Email
    info.shipping.address.recipient.phoneNo String 50 수령인 전화번호

    Return Codes

    Code Description
    0000 성공
    1101 구매 회원이 거래 불가 상태입니다.
    1102 구매 회원이 거래 불가 상태입니다.
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다.
    1106 헤더 정보 오류
    1110 사용할 수 없는 신용카드입니다
    1124 금액 정보 오류
    1141 계좌 상태 오류
    1142 잔액부족
    1150 거래 내역이 존재하지 않습니다.
    1152 동일한 거래된 내역이 있습니다.
    1153 결제 요청 금액과 결제하려는 금액이 다릅니다.
    1159 결제요청 정보가 없습니다.
    1169 LINE Pay에서 결제 수단 선택과 암호 인증을 해야 합니다.
    1170 회원 계좌의 잔액이 변동되었습니다.
    1172 이미 동일 주문번호로 거래된 내역이 존재합니다.
    1180 결제 유효시간이 지났습니다.
    1198 API 호출이 중복 요청되었습니다.
    1199 내부 요청 오류
    1280 신용카드 결제 중 일시적 오류
    1281 신용카드 결제 오류
    1282 신용카드 승인 오류
    1283 부정 사용이 의심되어 결제가 거절되었습니다.
    1284 신용카드 결제가 일시적으로 중단되었습니다.
    1285 신용카드 결제 정보 누락
    1286 신용카드 결제 정보가 잘못되었습니다.
    1287 신용카드 유효 기간이 초과되었습니다.
    1288 신용카드 결제 계좌의 잔고가 부족합니다
    1289 신용카드 한도 초과
    1290 신용카드 건당 결제 한도 초과
    1291 도난 신고된 카드입니다.
    1292 사용이 정지된 카드입니다.
    1293 CVN 입력 오류
    1294 블랙리스트에 등록된 카드입니다.
    1295 신용카드 번호가 잘못되었습니다.
    1296 처리할 수 없는 금액입니다.
    1298 카드 사용이 거절되었습니다.
    9000 내부 오류

    Sample

    Confirm API 요청 예제

    
    curl -X POST \
        -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}" \
        -H "X-LINE-Authorization-Nonce: 44453d45-768e-40e8-8349-748e797c450f" \
        -H "X-LINE-Authorization: {Hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
        -d '{ "amount": 1000, "currency":"JPY" }' \
        https://sandbox-api-pay.line.me/v3/payments/2018082512345678910/confirm
    
    

    Response

    결제 유형 payType이 NORMAL인 경우 잔고 결제

    
     {
         "returnCode": "0000",
         "returnMessage": "OK",
         "info": {
             "orderId": "MKSI_M_20180904_1000001",
             "transactionId": 2018082512345678910,
             "payInfo": [{
                 "method": "BALANCE",
                 "amount": 900
             }, {
                 "method": "DISCOUNT",
                 "amount": 100
             }],
         }
     }
    
    

    Capture API

    Request API 결제 요청시 "options.payment.capture"를 false로 설정된 거래는 Confirm API로 결제완료가 되면 매입대기 상태가 됩니다. 결제를 최종 확정하기 위해 Capture API로 추가로 매입 과정이 필요합니다.

    API Spec

    POST /v3/payments/authorizations/{transactionId}/capture

    Request Body

    항목 데이터 타입 필수 여부 설명
    amount number Y 결제 금액
    currency String(3byte) Y 결제 통화(ISO 4217)
    지원 가능한 통화는 아래와 같다.
    • USD
    • JPY
    • TWD
    • THB

    Response Body

    항목 데이터 타입 설명
    returnCode String(4byte) 결과 코드
    returnMessage String 결과 메시지 또는 실패 사유. 예를 들면 다음과 같은 경우다.
    • 결제 불가 가맹점
    • 가맹점 인증 정보 오류
    info.orderId String 결제 요청 시 가맹점에서 전달한 주문 번호
    info.transactionId number 결제 요청 결과로 전달받은 거래 번호(19자리)
    info[].payInfo[].method String 결제 시 사용된 결제 수단
    • 신용카드: CREDIT_CARD
    • 잔고: BALANCE
    • 할인: DISCOUNT
    info.payInfo[].amount number 결제 금액

    Return Codes

    Code Description
    0000 성공
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다
    1106 헤더 정보 오류
    1150 거래 내역이 존재하지 않습니다.
    1155 잘못된 거래번호입니다.
    1170 회원 계좌의 잔액이 변동되었습니다
    1172 이미 동일 주문번호로 거래된 내역이 존재합니다.
    1179 처리할 수 없는 상태입니다.
    1183 금액 오류
    1184 금액 오류
    1198 API 호출이 중복 요청되었거나, 내부 자동 재인증이되는 도중 매입 API호출이 되었습니다. (수분 후 재시도)
    1199 내부 요청 오류
    1280 신용카드 결제 중 일시적 오류
    1281 신용카드 결제 오류
    1282 신용카드 승인 오류
    1283 부정 사용이 의심되어 결제가 거절되었습니다.
    1284 신용카드 결제가 일시적으로 중단되었습니다.
    1285 신용카드 결제 정보 누락
    1286 신용카드 결제 정보가 잘못되었습니다.
    1287 신용카드 유효 기간이 초과되었습니다.
    1288 신용카드 결제 계좌의 잔고가 부족합니다
    1289 신용카드 한도 초과
    1290 신용카드 건당 결제 한도 초과
    1291 도난 신고된 카드입니다.
    1292 사용이 정지된 카드입니다.
    1293 CVN 입력 오류
    1294 블랙리스트에 등록된 카드입니다.
    1295 신용카드 번호가 잘못되었습니다.
    1296 처리할 수 없는 금액입니다.
    1298 카드 사용이 거절되었습니다.
    9000 내부 오류

    Sample

    Request

    
    curl -X POST \
        -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}" \
        -H "X-LINE-Authorization-Nonce: c3b3c9e5-701b-4df8-bcbc-e3ee86a1cef3" \
        -H "X-LINE-Authorization: {Hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
        -d '{ "amount": 1000, "currency": "JPY" }' https://sandbox-api-pay.line.me/v3/payments/authorizations/2018082512345678910/capture
    
    

    Response

    
    {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "transactionId": 20140101123123123,
            "orderId": "order_210124213",
            "payInfo": [{
                "method": "BALANCE",
                "amount": 10
            }, {
                "method": "DISCOUNT",
                "amount": 10
            }]
        }
    }
    
    

    Void API

    결제 상태가 인증 상태인 결제 데이터를 무효 처리한다. Confirm API로 결제 완료되어 인증 거래를 취소하는 API이다. 인증 상태 거래만 취소 처리할 수 있고 매입된 거래는 Refund API로 환불해야 합니다.

    API Spec

    POST /v3/payments/authorizations/{transactionId}/void

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과 코드
    returnMessage String 300 결과 메시지 또는 실패 사유. 예를 들면 다음과 같은 경우다.
    • 결제 불가 가맹점
    • 가맹점 인증 정보 오류

    Return Codes

    Code Description
    0000 성공
    1101 구매 회원이 거래 불가 상태입니다.
    1102 구매 회원이 거래 불가 상태입니다.
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다
    1106 헤더 정보 오류
    1150 거래 내역이 존재하지 않습니다.
    1155 잘못된 거래번호입니다.
    1165 이미 무효화된 거래입니다.
    1170 회원 계좌의 잔액이 변동되었습니다.
    1198 API 호출이 중복 요청되었습니다.
    1199 내부 요청 오류
    1900 일시적 오류입니다. 잠시 후 다시 시도하세요.
    1902 일시적 오류입니다. 잠시 후 다시 시도하세요.
    1999 이전 요청 정보와 다릅니다.
    9000 내부 오류

    Sample

    Request

    
    curl -X POST \
    -H "Content-Type: application/json" \
    -H "X-LINE-ChannelId: {your channelId}" \
    -H "X-LINE-Authorization-Nonce: 8335ce37-1386-4b0b-bd65-90d65abaedd6" \
    -H "X-LINE-Authorization: {signature}" \
    -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
    https://sandbox-api-pay.line.me/v3/payments/authorizations/2018082512345678910/void
    
    

    Response

    
    {
        "returnCode": "0000",
        "returnMessage": "OK"
    }
    
    

    Refund API

    결제완료(매입완료)된 거래를 환불한다. 환불 시 LINE Pay 회원의 결제 거래 번호는 필수로 전달되어야 하며 부분 환불도 가능하다.

    API Spec

    POST /v3/payments/{transactionId}/refund

    Request Body

    항목 데이터 타입 필수 여부 설명
    refundAmount number N 환불 금액
    • 전달되지 않은 경우 전체 환불

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과 코드
    returnMessage String 300 결과 메시지 또는 실패 사유
    info.refundTransactionId number 환불 거래 번호 (신규 발급-19자리)
    info.refundTransactionDate String 30 환불 거래 일시 (ISO 8601)

    Return Codes

    Code Description
    0000 성공
    1101 구매 회원이 거래 불가 상태입니다.
    1102 구매 회원이 거래 불가 상태입니다.
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다
    1106 헤더 정보 오류
    1124 금액 정보 오류
    1150 거래 내역이 존재하지 않습니다.
    1155 환불할 수 없는 거래 유형의 거래 번호입니다.
    1163 환불이 불가능합니다.(환불 가능일 초과)
    1164 환불 가능 금액을 초과하였습니다.
    1165 이미 환불된 거래입니다.
    1179 처리할 수 없는 상태입니다.
    1198 API 호출이 중복 요청되었습니다.
    1199 내부 요청 오류
    9000 내부 오류

    Sample

    Request

    
    curl -X POST -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}"\
        -H "X-LINE-Authorization-Nonce: 57d03ebc-0c79-404c-82e5-bb8b3b30fe56" \
        -H "X-LINE-Authorization: {Hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}"\
        -d '{ "refundAmount": 1000 }'\
        https://sandbox-api-pay.line.me/v3/payments/2018082512345678910/refund
    
    

    Response

    
    {
        "returnCode": "0000",
        "returnMessage": "success",
        "info": {
            "refundTransactionId": 2018082512345678911,
            "refundTransactionDate": "2018-08-25T09:15:01Z"
        }
    }
    
    

    Payment Details API

    LINE Pay의 결제된 거래 내역을 조회한다. 인증, 매입완료 거래를 조회할 수 있다. "fields" 설정을 통해 거래정보나 주문정보 필요에 따라 선택적으로 조회할 수 있습니다.

    API Spec

    GET /v3/payments

    Request Parameter

    항목 데이터 타입 필수 여부 설명
    transactionId[] number N LINE Pay 에서 발급한 결제 또는 환불 거래번호
    orderId[] String N 가맹점 주문 번호
    fields String N 조회대상 선택할수 있다.
  • TRANSACTION
  • ORDER
    default는 전체
  • 결제 조회 Response

    Response Body

    Common 정보

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 100 결과 메시지 또는 실패 사유

    Transaction 타입 조회 시

    항목 데이터 타입 길이 설명
    info[].transactionId number 거래번호(19 자리)
    info[].transactionDate String 20 거래 일시(ISO-8601)
    info[].transactionType String 거래 구분
    • PAYMENT: 결제
    • PAYMENT_REFUND: 환불
    • PARTIAL_REFUND: 부분 환불
    info[].payStatus String 20 결제 상태
    • AUTHORIZATION: 인증
    • VOIDED_AUTHORIZATION: 인증 무효("인증 무효 처리 API"를 호출한 상태)
    • EXPIRED_AUTHORIZATION: 인증 만료(LINE Pay에서 가맹점에게 허용한 인증 기한이 지난 경우)
    info[].productName String 4000 상품명
    info[].merchantName String 가맹점 이름
    info[].currency String 3 통화(ISO 4217)
    info[].authorizationExpireDate String 20 인증 거래 만료일시(ISO-8601)
    info[].payInfo[].method String 결제 시 사용된 결제 수단
    • 신용카드: CREDIT_CARD
    • 잔고: BALANCE
    • 할인: DISCOUNT
    info[].payInfo[].amount number 거래 금액(거래 번호 발생 시 거래된 거래 금액)
    원결제 거래를 조회할 때 최종 거래 금액 계산법
    sum(info[].payInfo[].amount) – sum(refundList[].refundAmount)

    Transaction 타입 조회 시 - 원결제 거래 조회 및 환불 거래가 있는 경우

    항목 데이터 타입 설명
    info[].refundList[].refundTransactionId number 환불 거래 번호(19 자리)
    info[].refundList[].transactionType String 거래 구분
    • PAYMENT_REFUND: 환불
    • PARTIAL_REFUND: 부분 환불
    info[].refundList[].refundAmount number 환불 금액
    info[].refundList[].refundTransactionDate String 환불 거래 일시 (ISO-8601)

    Transaction 타입 조회 시 - 환불 거래 조회 시

    항목 데이터 타입 설명
    info[].originalTransactionId number 원결제 거래 번호(19 자리)

    Order 타입 조회 시

    항목 데이터 타입 길이 설명
    info[].packages[].id String 50 배송 단위 Package list의 Unique Id
    info[].packages[].amount Number 배송단위 총 상품금액
    =sum(products[].quantity * products[].price)
    info[].packages[].userFeeAmount Number 사용자 수수료 : 결제 금액내에 수수료 항목이 존재시 응답
    info[].packages[].name String 100 배송 단위 이름 or (내부 Shop Name)
    info[].packages[].products[].id String 50 가맹점 판매상품의 Id
    info[].packages[].products[].name String 4000 판매상품명
    info[].packages[].products[].imageUrl String 500 판매상품 Image Url
    info[].packages[].products[].quantity Number 상품갯수
    info[].packages[].products[].price Number 상품별 결제금액
    info[].packages[].products[].originalPrice Number 상품별 원 금액
    info[].shipping.methodId String 50 사용자가 선택한 배송수단 ID
    info[].shipping.feeAmount Number 배송비
    info[].shipping.address.country String 2 배송지 국가
    info[].shipping.address.postalCode String 10 배송지 우편번호
    info[].shipping.address.state String 100 배송지 지역
    info[].shipping.address.city String 100 배송지 주소
    info[].shipping.address.detail String 1000 배송지 상세
    info[].shipping.address.optional String 1000 배송지 상세 추가정보
    info[].shipping.address.recipient.firstName String 200 수령인 이름
    info[].shipping.address.recipient.lastName String 200 수령인 성
    info[].shipping.address.recipient.firstNameOptional String 200 수령인 이름 추가정보
    info[].shipping.address.recipient.lastNameOptional String 200 수령인 성 추가정보
    info[].shipping.address.recipient.email String 100 수령인 Email
    info[].shipping.address.recipient.phoneNo String 50 수령인 전화번호

    Return Codes

    Code Description
    0000 성공
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다
    1106 헤더 정보 오류
    1150 거래 내역이 존재하지 않습니다.
    1177 최대 조회 가능한 거래 수 초과(100개)
    9000 내부오류

    Sample

    Request

    
    curl -X GET \
    -H "Content-Type: application/json" \
    -H "X-LINE-ChannelId: {your channelId}" \
    -H "X-LINE-Authorization-Nonce: ef6934b8-b42f-48db-87b7-e18e1fb1832e" \
    -H "X-LINE-Authorization: {Hmac signature}" \
    -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
    https://sandbox-api-pay.line.me/v3/payments?transactionId=20140101123123123&orderId=1002045572
    
    

    Response

    결제 거래 조회 시

    
    
    {
        "returnCode":"0000",
        "returnMessage":"success",
        "info":[{
           "transactionId":2019060112345678910,
           "transactionDate":"2019-06-01T09:00:00Z",
           "transactionType":"PAYMENT",
           "payInfo": [
               {"method":"BALANCE", "amount":100},
               {"method":"DISCOUNT", "amount":10}
             ],
           "productName":"tes production",
           "currency":"JPY",
           "orderId":"20190601ORD45678910",
           "refundList":[
              {
                 "refundTransactionId":"2019060112345678911",
                 "transactionType":"PARTIAL_REFUND",
                 "refundAmount":-1,
                 "refundTransactionDate":"2019-06-06T09:00:00Z"
              },
              {
                 "refundTransactionId":"2019060112345678911",
                 "transactionType":"PARTIAL_REFUND",
                 "refundAmount":-1,
                 "refundTransactionDate ":"2019-06-06T10:00:00Z"
              },
              {
                 "refundTransactionId":"2019060112345678911",
                 "transactionType":"PARTIAL_REFUND",
                 "refundAmount":-1,
                 "refundTransactionDate ":"2019-06-06T011:00:00Z"
              }
             ],
             "packages": [
                 {
                     "id": "1",
                     "amount": 85,
                     "userFeeAmount":0
                 },
                 {
                     "id": "3",
                     "amount": 5,
                     "userFeeAmount":0
                 }
             ],
             "shipping": {
                 "methodId": "FB-001",
                 "feeAmount": 20,
                 "address": {
                     "country": "JP",
                     "postalCode": "1600022",
                     "state": "東京都",
                     "city": " 渋谷区渋谷",
                     "detail": "(〒)150-8510 東京都 渋谷区渋谷",
                     "optional": "123",
                     "recipient": {
                       "firstName":"絵里",
                       "lastName":"松澤",
                       "firstNameOptional": "エリ",
                       "lastNameOptional": "マツザワ",
                       "phoneNo": "01999991234",
                       "email": "mksi@test.linecorp.com"
                     }
                 }
             }
        }]
     }
    
    

    환불 거래 조회 시

    
    {
        "returnCode":"0000",
        "returnMessage":"success",
        "info":[{
          "transactionId":2019060112345678912,
          "transactionDate":"2019-06-01T09:48:43Z",
          "transactionType":"PARTIAL_REFUND",
          "amount":-5,
          "productName":"Brown",
          "currency":"JPY",
          "orderId":"20190101123123123",
          "originalTransactionId":2019060112345678910
        }]
    }
    
    

    Check Payment Status API

    LINE Pay의 결제요청의 상태를 조회한다. confirmUrl을 사용하지 않고 가맹점에서 주기적으로 결제 상태를 조회하여 사용자 결제 승인 여부를 조회하여 결제완료 가능여부를 판단한다.

    API Spec

    GET /v3/payments/requests/{transactionId}/check

    조회 Response

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 100 결과 메시지 또는 실패 사유
    info.shipping.methodId String 50 사용자가 선택한 배송수단 ID
    info.shipping.feeAmount Number 배송비

    Return Code

    Code Description
    0000 before authorization
    0110 authorization done. - available to call "confirm api"
    0121 payment canceled by user or timeout(20min). - terminated status
    0122 payment failed. - terminated status
    0123 payment completed. - terminated status
    1104 merchant not found
    1105 merchant status error
    9000 internal error

    Sample

    Request

    
    curl -X GET \
    -H "Content-Type: application/json" \
    -H "X-LINE-ChannelId: {your channelId}" \
    -H "X-LINE-Authorization-Nonce: e51779e1-5788-4884-9c3a-52f7bf8cb0fa" \
    -H "X-LINE-Authorization: {Hmac signature}" \
    -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
    https://sandbox-api-pay.line.me/v3/payments/requests/2018110112345678910/check
    
    

    Response - 일반결제

    
    {
       "returnCode":"0000",
       "returnMessage":"success"
    }
    
    

    Response - Checkout 결제

    
    {
       "returnCode":"0000",
       "returnMessage":"success",
       "info": {
           "shipping": {
                "methodId": "FB-001",
                "feeAmount": 20
            }
       }
    }
    
    

    Check RegKey API

    발급된 RegKey의 상태를 조회한다.

    API Spec

    GET /v3/payments/preapprovedPay/{regKey}/check

    Parameter

    항목 데이터 타입 필수 여부 설명
    creditCardAuth Boolean N RegKey를 발급한 신용카드의 최소금액 인증 여부
    • true : LINE Pay 검증과 신용카드의 최소금액 인증을 진행하여 RegKey의 상태를 조회한다. 단, LINE Pay 관리자 검수가 필요
    • false : LINE Pay 검증으로 RegKey 상태를 조회한다.

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 300 결과메세지

    Return Codes

    Code Description
    0000 Success.
    1101 Purchaser status error.
    1102 Purchaser status error.
    1104 Merchant not found.
    1105 This Merchant cannot use LINE Pay.
    1106 Header information error.
    1141 Account status error.
    1154 Preapproved payment account not available.
    1190 The regKey does not exist.
    1193 The regKey expired.

    Sample

    Pay Preapproved API 요청 예제

    
    curl -X GET \
        -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}" \
        -H "X-LINE-Authorization-Nonce: df9c7e0e-e6c4-4d24-9847-b8f3cbe9bf58" \
        -H "X-LINE-Authorization: {Hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
        https://sandbox-api-pay.line.me/v3/payments/preapprovedPay/RK123asd213/check
    
    

    Response

    
     {
        "returnCode": "0000",
        "returnMessage": "OK",
    }
    
    

    Pay Preapproved API

    Request APIConfirm API로 자동결제 등록 과정이 필요합니다. Confirm API로 전달된 RegKey를 이용하여 사용자 결제 승인 과정 없이 결제를 진행합니다.

    API Spec

    POST /v3/payments/preapprovedPay/{regKey}/payment

    Request Body

    항목 데이터 타입 길이 필수 여부 설명
    productName String 4000 Y 상품명
    amount number Y 결제 금액
    currency String 3 Y 결제 통화(ISO 4217)
    지원 가능한 통화는 아래와 같다.
    • USD
    • JPY
    • TWD
    • THB
    orderId String 100 Y 가맹점 Unique 주문번호
    capture Boolean N 매입여부 )
    ul>
  • true : 인증/매입
  • false : 인증, 결제인증 매입 v3 API로 매입 필요
  • Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 300 결과메세지
    info.orderId String 100 결제 요청시 전달한 가맹점 Unique 주문번호
    info.transactionId Number 결제 요청 결과로 전달받은 거래 번호(19자리)
    info.transactionDate String 30 거래 일시 (ISO 8601)
    info.authorizationExpireDate String 30 opt-인증 만료 일시(ISO 8601)

    Return Codes

    Code Description
    0000 성공
    1101 구매 회원이 거래 불가 상태입니다.
    1102 구매 회원이 거래 불가 상태입니다.
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay를 이용할 수 없는 상태입니다.
    1106 헤더 정보 오류
    1110 사용할 수 없는 신용카드입니다
    1124 금액 정보 오류
    1141 계좌 상태 오류
    1142 잔액부족
    1150 거래 내역이 존재하지 않습니다.
    1152 동일한 거래된 내역이 있습니다.
    1153 결제 요청 금액과 결제하려는 금액이 다릅니다.
    1159 결제요청 정보가 없습니다.
    1169 LINE Pay에서 결제 수단 선택과 암호 인증을 해야 합니다.
    1170 회원 계좌의 잔액이 변동되었습니다.
    1172 이미 동일 주문번호로 거래된 내역이 존재합니다.
    1180 결제 유효시간이 지났습니다.
    1198 API 호출이 중복 요청되었습니다.
    1199 내부 요청 오류
    1280 신용카드 결제 중 일시적 오류
    1281 신용카드 결제 오류
    1282 신용카드 승인 오류
    1283 부정 사용이 의심되어 결제가 거절되었습니다.
    1284 신용카드 결제가 일시적으로 중단되었습니다.
    1285 신용카드 결제 정보 누락
    1286 신용카드 결제 정보가 잘못되었습니다.
    1287 신용카드 유효 기간이 초과되었습니다.
    1288 신용카드 결제 계좌의 잔고가 부족합니다
    1289 신용카드 한도 초과
    1290 신용카드 건당 결제 한도 초과
    1291 도난 신고된 카드입니다.
    1292 사용이 정지된 카드입니다.
    1293 CVN 입력 오류
    1294 블랙리스트에 등록된 카드입니다.
    1295 신용카드 번호가 잘못되었습니다.
    1296 처리할 수 없는 금액입니다.
    1298 카드 사용이 거절되었습니다.
    9000 내부 오류

    Sample

    Pay Preapproved API 요청 예제

    curl -X POST \
        -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}" \
        -H "X-LINE-Authorize-Nonce: 6120489b-53f3-4c51-9d6f-b80be93e509a"\
        -H "X-LINE-Authorization: {hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
        -d '{ "productName":"Brown pen", "amount": 1000, "currency":"JPY", "orderId":"Ord2018123100000001" }' \
        https://sandbox-api-pay.line.me/v3/payments/preapprovedPay/RK123asd213/payment
    
    

    Response

    capture : true 응답 에제

    
     {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "transactionId": 2018123112345678910,
            "transactionDate": "2018-12-31T09:00:31Z"   
        }
    }
    
    

    capture : false 응답 에제

    
     {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "transactionId": 2018123112345678910,
            "transactionDate": "2018-12-31T09:00:31Z",
            "authorizationExpireDate": "2019-01-31T09:00:31Z",
        }
    }
    
    

    Expire RegKey API

    발급된 RegKey를 만료한다.

    API Spec

    POST /v3/payments/preapprovedPay/{regKey}/expire

    Response Body

    항목 데이터 타입 길이 설명
    returnCode String 4 결과코드
    returnMessage String 300 결과메세지

    Return Codes

    Code Description
    0000 Success.
    1104 Merchant not found.
    1105 This Merchant cannot use LINE Pay.
    1106 Header information error.
    1190 The regKey does not exist.
    1193 The regKey expired.

    Sample

    Pay Preapproved API 요청 예제

    curl -X POST \
        -H "Content-Type: application/json" \
        -H "X-LINE-ChannelId: {your channelId}" \
        -H "X-LINE-Authorization-Nonce: 5c75efcc-9c5e-4a32-9fe3-5d55ce67b598" \
        -H "X-LINE-Authorization: {Hmac signature}" \
        -H "X-LINE-MerchantDeviceProfileId: {your device profile id}" \
        https://sandbox-api-pay.line.me/v3/payments/preapprovedPay/RK123asd213/expire
    
    44453d45-768e-40e8-8349-748e797c450f
    

    Response

    
     {
        "returnCode": "0000",
        "returnMessage": "OK",
    }
    
    

    Merchant provided API or Page

    Merchant provided API or Page

    가맹점에서 LINE Pay에게 제공해야되는 API(or page url)에 대해 기술한다. 운영환경에서 반드시 신뢰할수 있는 인증서와 HTTPS Protocol을 사용해야 한다. 또한, 인증서는 보안상 TLS 1.2 버젼 이상을 사용한다.

    Access Control List

    가맹점에서 제공하는 API가 접근 제어를 IP로 관리한다면 아래 환경별 LINE Pay Server IP를 등록해야 합니다.

    confirmUrl Spec

    confirmUrlType에 따라 Page 또는 API 형태로 가맹점이 제공해야 한다. LINE Pay app에서 사용자가 결제를 승인하면 confirmUrl을 통해 가맹점의 결제진행 화면을 사용자에게 보여주고 사용자의 승인이 완료됨을 가맹점에 알려준다. Confirm API를 통해 결제 완료후에 결제 완료로 이동하는 중간 페이지 역활도 한다. 다만 사용자에게 화면 제공이 필요없는 특수한 결제 유형은 Page 제공 없이 Http Stutas 200 응답으로 진행이 가능하다.

    API 명세

    항목 설명
    Protocol HTTP
    Method GET
    Request timeout Connection: 5초
    Read: 20초

    Request Parameters

    파라미터 필수 설명
    orderId Y 결제요청 시 가맹점에서 전달한 주문 번호
    transactionId Y 결제요청 시 결과로 전달받은 거래 번호
    shippingFeeAmount N Checkout의 배송비금액
    shippingMethodId N 가맹점의 배송수단중 선택된 수단 ID

    가맹점에서는 응답 결과로 별도의 정보를 전달하지 않고 LINE Pay에서는 HTTP 응답 코드로 성공 여부를 판단한다. HTTP 응답 코드가 성공(200 OK)이 아니면 LINE Pay 회원에게 결제가 정상적으로 처리되지 않았다는 알림을 보낸다.

    Response

    Sample

    Request 가맹점이 제공한 confirmUrl이 'http://testmall.com/pay/result'이라 가정

    
    curl -X GET \ 
        http://testmall.com/pay/result?orderId=2018xxx1232132&trasactionId=201810281234567890&shippingFeeAmount=2100&shippingMethodId=1
    
    

    Success Response

    
    HTTP/1.1 200 OK
    Accept-Charset: utf-8
    Content-Type: text/html
    Content-Length: 2
    Date: Sat, 11 Oct 2018 02:45:48 GMT
    
    

    Fail Response

    
    HTTP/1.1 404 NOT_FOUND
    Accept-Charset:utf-8
    Content-Type:text/html
    Content-Length:4
    Date:Sat, 11 Oct 2018 02:45:48 GMT
    
    

    cancelUrl

    사용자가 LINE Pay App 결제화면에서 결제 도중 취소를 하면 Request API로 전달된 cancelUrl을 이용하여 가맹점 페이지 이동을 합니다. cancelUrl의 Query String에 transactionId, orderId가 없다면 자동으로 추가되어 전달됩니다.

    Inquiry ShippingMethods API

    Checkout을 사용하는 가맹점은 해당 API Spec을 구현하여 LINE Pay로 Request API를 통해 제공해야한다. 사용자가 배송지를 선택하면 Postal Code(ZipCode)로 API로 배송 가능여부와 배송 가능한 수단, 배송비를 조회한다. 사용자가 선택한 배송수단과 배송비는 confirmUrl을 통해 가맹점에게 제공된다.

    API 명세

    항목 설명
    Protocol HTTP
    Method POST
    Request timeout Connection: 5초
    Read: 20초

    Request

    Key Value Desc
    Content-Type application/json
    파라미터 데이타타입 길이 필수 설명
    currency String 3 Y 배송비 통화
    orderId String 100 Y 결제요청 시 가맹점에서 전달한 주문 번호
    transactionId Number Y 결제요청 시 결과로 전달받은 거래 번호
    shippingAddress.country String 2 N 배송지 국가
    shippingAddress.postalCode String 10 N 배송지 우편번호
    shippingAddress.state String 100 N 배송지 주
    shippingAddress.city String 300 N 배송지 도시

    Response Body

    파라미터 데이타타입 길이 필수 설명
    returnCode String 3 Y 결과코드
    returnMessage String 100 N 결과 메세지
    info.shippingMethods[].id String Y 가맹점 배송수단 ID
    info.shippingMethods[].name String 100 Y 배송수단명
    info.shippingMethods[].amount Number Y 배송비
    info.shippingMethods[].toDeliveryYmd String 8 N 배송 예정일 (YYYYMMDD)
    info.shippingMethods[].fromDeliveryHm String 4 N 배송 예정 시작시각 (HHmm)
    info.shippingMethods[].toDeliveryHm String 4 N 배송 예정 종료시각 (HHmm)

    Return Codes

    Code Description
    0000 성공
    4001 배송불가 지역
    4002 잘못된 배송지
    5001 Internal Server Error(Unknown Error)
    9999 System Maintainance

    Sample

    Response

    지정된 배송일이 없을 때

    {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "shippingMethods":[
                {
                    "id": "1",
                    "name": "FAST POST",
                    "amount": 500
                }
            ] 
        }
    }
    

    사용자 Message 예시

    
    FAST POST - 500
    
    

    지정된 배송시간이 없을 때 (배송완료일자만 있을 때)

    {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "shippingMethods":[
                {
                    "id": "1",
                    "name": "FAST POST",
                    "amount": 500,
                    "toDeliveryYmd": "20181030"
                }
            ] 
        }
    }
    

    사용자 Message 예시

    
    FAST POST - 500
    2018/10/30 시간 지정 없음
    
    

    배송완료일자와 배송시작시간, 배송완료시간이 모두 있을 때

    {
        "returnCode": "0000",
        "returnMessage": "OK",
        "info": {
            "shippingMethods":[
                {
                    "id": "1",
                    "name": "FAST POST",
                    "amount": 500,
                    "toDeliveryYmd": "20181030",
                    "fromDeliveryHm": "1000",
                    "toDeliveryHm": "1200",
                }
            ] 
        }
    }
    

    사용자 Message 예시

    
    FAST POST - 500
    2018/10/30 10:00 ~ 12:00
    
    

    Appendix

    LINE Pay 오류 코드

    LINE Pay 에서 발생하는 오류 코드에 대해 정의한다. 오류 코드에 대한 returnMessage 는 영어로 제공되며, 별도로 메시지가 없는 경우에는 하이픈(-)이 전달된다.

    Code Description
    1101 LINE Pay 회원이 아닙니다.
    1102 구매 회원이 거래 불가 상태입니다.
    1104 가맹점이 존재하지 않습니다.
    1105 현 가맹점은 LINE Pay 를 이용할 수 없는 상태입니다.
    1106 헤더 정보 오류
    1110 사용할 수 없는 신용카드입니다.
    1124 금액 정보 오류입니다(scale).
    1141 결제 계좌 상태 오류
    1142 잔액 부족
    1145 결제 진행 중 입니다.
    1150 거래 내역이 존재하지 않습니다.
    1152 동일한 거래된 내역이 있습니다.
    1153 결제금액이 결제 요청시 금액과 다릅니다.
    1154 자동 결제에 설정한 결제수단을 이용할 수 없는 상태입니다.
    1155 환불할 수 없는 거래 유형의 거래 번호입니다.
    1159 결제 요청정보가 없습니다.
    1163 환불 가능일이 지나 환불이 불가능합니다.
    1164 환불 가능 금액을 초과하였습니다.
    1165 이미 환불된 거래입니다.
    1169 결제 confirm 을 위한 정보 오류(LINE Pay 에서 결제 수단 선택과 암호 인증을 해야 합니다.)
    1170 회원 계좌의 잔액이 변동되었습니다.
    1172 이미 동일 주문번호로 거래된 내역이 존재합니다.
    1177 최대 조회 가능한 거래 수 초과(100 개)
    1178 가맹점이 지원하지 않는 통화입니다.
    1179 처리할 수 없는 상태입니다.
    1180 결제 유효시간이 지났습니다.
    1183 결제금액이 0 보다 커야 합니다.
    1184 결제금액이 요청시 금액을 초과합니다.
    1190 regKey 가 존재하지 않습니다.
    1193 regKey 가 만료되었습니다.
    1194 자동 결제를 사용할 수 없는 가맹점
    1197 regKey 로 이미 결제 중입니다.
    1198 요청 처리 중입니다.
    1199 내부 요청 오류
    1280 신용카드 결제 중 일시적 오류
    1281 신용카드 결제 오류
    1282 신용카드 승인 오류
    1283 부정 사용이 의심되어 결제가 거절되었습니다.
    1284 신용카드 결제가 일시적으로 중단 되었습니다.
    1285 신용카드 결제 정보 누락
    1286 잘못된 신용카드 결제 정보
    1287 신용카드 유효기간이 초과되었습니다.
    1288 신용카드 결제 은행 잔고가 부족합니다
    1289 신용카드 한도 초과
    1290 신용카드 건당 결제 한도 초과
    1291 도난 신고된 카드입니다.
    1292 사용이 정지된 카드입니다.
    1293 CVN 입력 오류
    1294 블랙리스트에 등록된 카드입니다.
    1295 신용카드 번호가 잘못되었습니다.
    1296 처리할 수 없는 금액입니다.
    1298 카드 사용이 거절되었습니다.
    2101 파라미터 오류
    2102 JSON 데이터 포맷 오류
    9000 내부 오류

    PaymentUrl Guide

    가맹점 App에서 결제를 요청한 이후에 LINE App으로 App 간 이동을 하기 위한 가이드다.

    Android Sample

    아래의 예제 코드로 LINE 앱 설치 여부와 사용 가능한 LINE Pay 의 버전을 확인할 수 있다. LINE 앱이 설치되어 있고 사용 가능한 LINE Pay 의 버전이 확인되면 LINE Pay 결제 화면으로 이동한다.

    Android

        int linePaySupportedVersion = 230;
        String paymentUrl = "..."; // This is "paymentUrl.app" URL String.
        Context context = getActivity();
        try {
            PackageManager pm = context.getPackageManager();
            PackageInfo packageInfo = pm.getPackageInfo("jp.naver.line.android", 0);
            int versionCode = packageInfo.versionCode;
            if (linePaySupportedVersion <= versionCode) {
            launchUri(paymentUrl);
            } else {
            confirmLineInstall(context);
            }
        } catch (NameNotFoundException e) {
            confirmLineInstall(context);
        }
        private void confirmLineInstall(Context context) {
            new AlertDialog.Builder(context)
            .setTitle("LINE Pay")
            .setMessage(getString(R.String.linepay_confirm))
            .setCancelable(false)
            .setPositiveButton(getString(R.String.linepay_install), new
        DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
            launchUri("market://details?id=jp.naver.line.android");
            }
            })
            .setNegativeButton(getString(R.String.linepay_cancel), new
        DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
            }
            })
            .show();
        }
        private void launchUri(String uriString) {
            Uri uri = Uri.parse(uriString);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        }
    

    File : res/values/Strings.xml

    
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
     ...
     <String name="linepay_confirm">Supported by Android/iPhone LINE versions 4.8.0
    or higher.</String>
     <String name="linepay_install">Get it now</String>
     <String name="linepay_cancel">cancel</String>
     ...
    </resources>
    

    iPhone Sample

    아래의 예제 코드로 LINE 앱의 설치 여부를 확인할 수 있다. LINE 앱이 설치되어 있으면 LINE Pay 결제 화면으로 이동한다.

    iOS

    
        NSString* lineScheme = @"line://";
        BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:lineScheme]];
        if (installed) {    
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LINE Pay"
        message:NSLocalizedString(@"linepay.confirm", nil)
                delegate:self
        cancelButtonTitle:NSLocalizedString(@"linepay.ok", nil) otherButtonTitles:nil];
                alert.tag = 1;
                [alert show];
        } else {
                UIAlertView *alert =
                [[UIAlertView alloc] initWithTitle:@"LINE Pay"
        message:NSLocalizedString(@"linepay.confirm", nil)
                delegate:self
        cancelButtonTitle:NSLocalizedString(@"linepay.cancel", nil)
                otherButtonTitles:NSLocalizedString(@"linepay.install",
        nil), nil];
                alert.tag = 2;
                [alert show];
        }
        - (void)alertView:(UIAlertView*)alertView
        clickedButtonAtIndex:(NSInteger)buttonIndex {
                if (alertView.tag == 1 && buttonIndex == 0) {
                NSString *paymentUrl = ...; // This is "paymentUrl.app" URL String.
                [self launchUrl:paymentUrl];
                } else if (alertView.tag == 2 && buttonIndex == 1) {
                [self launchUrl:@"itmsapps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=443904275&mt=8"];
                }
        }
        - (void)launchUrl:(NSString*)urlString {
                NSURL *url = [NSURL URLWithString:urlString];
                [[UIApplication sharedApplication] openURL:url];
        }
    
    

    File : en.lproj/Localized.Strings

    
    "linepay.confirm" = "Supported by Android/iPhone LINE versions 4.8.0 or higher.";
    "linepay.ok" = "OK";
    "linepay.cancel" = "Cancel";
    "linepay.install" = "Get it now";
    
    

    Sandbox

    Sandbox 사용

    LINE Pay 에서 Sandbox 환경을 제공한다. Sandbox 테스트 할 경우 본 연동가이드에서 제공하는 API Endpoint 명세에 기재된 Sandbox용 EndPoint를 활용하여 결제를 시도한다. confirmUrlInquiry ShippingMethods API를 준비를 해야 한다. Sandbox 환경에서 결제를 시도하는 경우 다음과 같이 처리된다.

    Sandbox PC Payment

    Sandbox pc payment process

    Sandbox Mobile Payment

    Sandbox mobile payment process

    특이사항

    Sandbox 환경에서는 PC, Mobile 환경 모두 채널 로그인을 요구한다. (단, 리얼에서 연동하는 경우, Mobile 활용시 LINE App으로 직접 이동하여 채널 로그인이 필요없다.)

    Migration API v3

    Payment API v2에서 v3으로 이행시 고려해야될 부분은 API 인증이 HMAC Signature 검증으로 변경과 Request API Version 3의 변경입니다.

    Authentication

    Payment API V2의 ID, Password 인증 방식을 Version 3에서는 HMAC으로 인증과 메세지 검증하도록 변경됩니다. Ver 2의 Password로써 전달하던 X-LINE-ChannelSecret는 Merchant내에서 보관하고 SecretKey를 사용하여 Hmac Signature를 생성시 사용합니다. X-LINE-Authorization-Nonce 랜덤으로 생성되는 값을 사용하여 Signature의 보안을 높일수 있습니다. 자세한 내용은 API Authentication을 참조합니다.

    Http Request Headers

    Header Version 2 Version 3 Description
    X-LINE-ChannelId O O 변경없음
    X-LINE-ChannelSecret O X 삭제
    X-LINE-MerchantDeviceProfileId O O 변경없음
    X-LINE-Authorization-Nonce X O 신규
    X-LINE-Authorization X O 신규

    Request API

    Request API v3의 가장 큰 변화는 풍부한 상품/주문 정보를 사용자에게 제공하며 LINE 회원정보를 활용하여 간편하고 편리하게 Checkout 기능을 제공합니다. Ver 2의 단일 상품명으로 정의된 productName, productImageUrlpackage[] 구조를 통해 상품별로 결제할 사용자에게 결제정보를 상세하게 제공할수 있습니다. options.shipping은 Checkout을 위해 정의되었습니다. 자세한 내용은 Request API을 참조합니다.

    Request Body Mapping

    Version 2 Version 3 Description
    amount amount 변경없음
    currency currency 변경없음
    orderId orderId 변경없음
    packages[].id new
    packages[].amount new
    packages[].userFee new
    packages[].name new
    packages[].products[].id 단일상품 -> 다중상품
    productName packages[].products[].name 단일상품 -> 다중상품
    productImageUrl packages[].products[].imageUrl 단일상품 -> 다중상품
    packages[].products[].quantity new
    packages[].products[].price new
    packages[].products[].originalPrice new
    packageName redirectUrls.appPackageName 이름변경
    confirmUrl redirectUrls.confirmUrl
    confirmUrlType redirectUrls.confirmUrlType
    cancelUrl redirectUrls.cancelUrl
    capture options.payment.capture
    payType options.payment.payType
    langCd options.display.locale 이름변경
    checkConfirmUrlBrowser options.display.checkConfirmUrlBrowser
    extras.addFriends[].type options.familyService.addFriends[].type
    extras.addFriends[].idList[] options.familyService.addFriends[].idList[]
    options.shipping.* new