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

    OverView

    LINE Pay

    LINE Pay is a payment system that can be used by LINE members at the LINE Pay affiliated store sites.

    Payment process

    Payment process of the LINE Pay

    When stores join the LINE Pay affiliation, they can make all LINE members across the world as their affiliated customers. Furthermore, they can expect sales increase by expending the marketing channel through LINE. For LINE Pay members to process payment with the LINE Pay in a store, the store must be registered as one of the LINE Pay affiliates.

    Steps to register as a LINE Pay affiliated store

    When registered as a LINE Pay affiliated store, Channel Id and Channel SecretKey for integration are issued for Sandbox and Production respectively. The registration steps of the affiliated store is as follows.

    En register merchant

    Steps to register as a LINE Pay affiliated store

    1. Make an access to the registration page (https://pay.line.me).
    2. Fill in basic information and submit required documents.
    3. Under review process of the registration
    4. Agree to commissions and settlement cycle and enter PIN for identification
    5. Registration completed
    6. Registration completion email will be sent

    General payment

    LINE Pay members should choose one of payment methods out of balance, credit card, bank account, and LINE point from the LINE Pay payment page and authorize the payment information with a passcode. With affiliated store's ConfirmUrl sent through Request API, move to other page and the affiliated store server will complete the payment with a Confirm API.

    For PC

    Pc payment reserve complete

    Payment page on PC-Payment complete

    1. LINE Pay member should choose a payment method from the LINE Pay payment page and enter the password.
    2. After choosing the payment method, save it and activate the payment status.
    3. Afterwards, check the payment information page in the LINE Pay.
    4. Check the activation status from the payment standby page on PC and if the status is activated, go to ConfirmUrl received from the affiliated store when making the payment request.
    5. The affiliated store should complete the payment by calling the Confirm API through LINE Pay.

    For mobile

    Mobile payment reserve complete

    Payment page on mobile-Payment complete

    1. LINE Pay member should choose a payment method from the LINE Pay payment page and enter the password.
    2. After choosing the payment method, save it and activate the payment status.
    3. Afterwards, check the payment information page in the LINE Pay and click the check button located at the bottom to go to ConfirmUrl received from the affiliated store when making the payment request.
    4. The affiliated store should complete the payment by calling the Confirm API through LINE Pay.

    Separating between authorization and purchase (Capture)

    When a payment is confirmed with the Confirm API, the payment is completed as purchase standby status. The LINE Pay maintains the purchase standby status until authorization expires. Before the expiration, the affiliated store changes the status as purchased through "Purchase(Capture API)" process.

    ConfirmUrl's Server-to-Server

    In general payment, the ConfirmUrl notices the affiliated store about the completion of payment approval and provides a page navigating to the payment completion to user. However, if the payment completion page does not need to be shown to user, set redirectUrls.confirmUrlType as SERVER so that the ConfirmUrl can be requested to notice the payment approval from the LINE Pay server without having to move to other page. After the payment is approved by user, process the completion with the Confirm API between the affiliated store server and the LINE Pay server. The integration flow is as follows.

    Send confirm url server to server

    Send the ConfirmUrl sever-to-server

    1. The affiliated store should set redirectUrls.confirmUrlType of payment API as SERVER.
    2. LINE Pay member should access to the LINE Pay payment page and select a payment method and enter password.
    3. The LINE Pay server saves the payment info and calls the ConfirmUrl sent by the store when requesting the payment.
    4. The store server completes the payment by calling the Confirm API. If the response to the ConfirmUrl is not sent normally, the Confirm API cannot be called.

    [Merchant API] confirmUrl

    Checkout

    Using various payment methods provided by LINE Pay such as balance, credit card, bank account, LINE Point, and LINE member information, members can conveniently process payment and orders.

    Checkout Flow

    En checkout flow

    Checkout flow

    1. With the request API of the LINE Pay, make a request for payment information. To activate the checkout service when requesting, set "shipping.type" as SHIPPING and provide an API to the LINE Pay via shipping.feeInquiryUrl, where you can view shipping methods or shipping fee.
    2. With paymentUrl found in payment request API's response information, you can access to the LINE Pay payment page.

    3. LINE Pay member can check purchasing product and payment information from the LINE Pay app payment page and enter the shipping address. Once the shipping address is entered, the LINE Pay searches for available shipping methods of the store with the address and order information (orderId, transactionId) for the member to choose one of the shipping methods.

    4. After choosing the shipping method and payment method, the member can approve the payment request using the safe and simple LINE Pay user authentication.

    5. After the member's approval, add the shipping fee and selected shipping method to the ConfirmUrl provided by the store and go to the ConfirmUrl from member's device.

    6. Give notice to the store that they can complete the payment since the request has been approved. The payment request with the called ConfirmUrl calls the Confirm API from the store to complete the payment.

    Checkout type

    LINE Pay provides the checkout feature and general payment with a "shipping.type" option. To provide the checkout feature to users, set the checkout option as SHIPPING. To provide general payment, set the option as NO_SHIPPING and the default value is NO_SHIPPING .

    Highly Recommended

    Shipping methods

    When a LINE Pay member enter shipping address, they must be provided with a list of shipping company, fee, and expected shipping period to the member. APIs to be provided can be checked from Inquiry ShippingMethods API.

    When the member selects the shipping address at the checkout page, the LINE Pay will request information of shipping region to the store. The selected shipping method and fee are sent through Query String of the ConfirmUrl. For more details, see confirmUrl Spec.

    The general checkout sets shipping.feeInquiryType as CONDITION to cope with shipping fee and information that varies depending on shipping destination. For products with fixed or free shipping fee, you can choose to set as FIXED. For free or fixed shipping, the LINE Pay does not request information to the store including shipping method or shipping standard fee even when the member changes shipping address.

    High Recommended

    Shipping Recipient

    Only Japan

    On the information of recipient, firstName, lastName should be filled in with Chinese characters and firstNameOptional, lastNameOptional in Katakana.

    Automatic payment

    The automatic payment allows payment between the store server and LINE Pay server through an automatic payment API without additional approval from LINE Pay member. The store receives a RegKey (A key used for automatic payment) through LINE Pay member's first payment (Same process as the general payment). The store issues and manages the RegKey sent through the Confirm API and completes the payment with the automatic payment API without the step of user approval.

    1. Processing the first payment and issuing the RegKey
      1. Call a payment request API from the store server (From the request info, set "options.payment.payType" as "PREAPPROVED").
      2. Check the payment method and payment password from the LINE Pay payment page and move to redirectUrls.confirmUrl (The payment request API parameter).
      3. Manage the RegKey issued as a response to the payment Confirm API from the store server
      4. Payment completed
    1. Automatic payment
      1. Call automatic payment API with the RegKey
      2. Payment completed

    Preapproved payment Automatic payment

    1. Request for RegKey expiration to stop the automatic payment
      1. Call RegKey sending API for expiration
      2. Expire the RegKey, the automatic payment key

    Payment APIs

    Infra and Tech Support

    For technical support such as inquiries on internal errors or infra, contact to (pay_tech@linecorp.com).

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

    API Authentication

    The following describes authentication and its methods of the Payment API of LINE Pay. Channel ID and Channel SecretKey information required for the authentication can be checked from the merchant center (https://pay.line.me) after the merchant review is completed. For synchronization, LINE Pay supports the Sandbox environment. You can check both test channel info (ID, SecretKey) usable in the Sandbox environment and actual channel info (ID, SecretKey) in the production environment from the merchant center.

    Hmac Signature

    HTTP Method : GET

    Signature = Base64(HMAC-SHA256(Your ChannelSecret, (Your ChannelSecret + URL Path + Query String + nonce))) Query String : A query string except ? (Example: Name1=Value1&Name2=Value2...)

    HTTP Method : POST

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

    Common HTTP Request Header

    The following is detailed explanation on common headers of LINE Pay APIs authentication. HTTP header information for the authentication is listed on below table. X-LINE-ChannelId is the Channel ID and the signature information generated with the Channel SecretKey should be set on X-LINE-Authorization. Generate one-time values randomly to use the X-LINE-Authorization-Nonce to prevent from using a same 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

    Use the one-time random value nonce when generating HMAC signature to block the signature generation and prevent sending the same request with malicious purpose. The one-time nonce can use UUID 1 or 4 or a timestamp.

    Create 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

    An API to request payment information to LINE Pay. User can change settings such as order information or various payment methods. Once the request is successful, a transaction ID is generated and with the ID, you can complete the payment or process refund.

    API Spec

    POST /v3/payments/request

    Request

    Request Body

    Item Data type Length Requirement Description
    amount Number Y Payment amount
    = sum(packages[].amount) + sum(packages[].userFee) + options.shipping.feeAmount
    currency String 3 Y Payment currency (ISO 4217)
  • Supported currencies: USD, JPY, TWD, THB
  • orderId String 100 Y An order ID of payment request from the merchant
  • An unique ID managed by the merchant
  • packages[].id String 50 Y An unique ID of package list
    packages[].amount Number Y Total amount of products per package
    =sum(products[].quantity * products[].price)
    packages[].userFee Number N User fee: Respond if a commission is found within the payment amount.
    packages[].name String 100 Y Name of the package or name of internal shops
    packages[].products[].id String 50 N ID of sales products of the merchant
    packages[].products[].name String 4000 Y Name of the sales products
    packages[].products[].imageUrl String 500 N Image URL of the sales products
    packages[].products[].quantity Number Y Number of products
    packages[].products[].price Number Y Price of each product
    packages[].products[].originalPrice Number N Original price of each product
    redirectUrls.appPackageName String 4000 N An information to prevent phishing while transferring between apps in Android.
    redirectUrls.confirmUrl String 500 Y A merchant URL user moves to after requesting the payment.
    redirectUrls.confirmUrlType String N A navigation type of the ConfirmURL after user approves the payment request.
    redirectUrls.cancelUrl String 500 Y A URL that moves to the next when LINE Pay member cancels the payment from the payment page.
    options.payment.capture Boolean N Regarding automatic payment
  • True: Processing authorization and purchase with the Confirm API at the same time
  • False: Authorized with the Confirm API but need to purchase with the Capture API.
  • options.payment.payType String N Payment options
  • NORMAL
  • PREAPPROVED
  • options.display.locale String N Language codes of the payment standby screen. The default language is English (en).
  • Supported languages: en, ja, ko, th, zh_TW, zh_CN
  • options.display.checkConfirmUrlBrowser Boolean N Checking the payment browser when moving to the ConfirmURL
  • True : Guide user to go to the LINE Pay payment request browser if payment request browser and the ConfirmURL navigation browser are different.
  • False : Move the the ConfirmURL immediately without checking the browser
  • options.shipping.type String N Shipping address options
  • NO_SHIPPING
  • FIXED_ADDRESS
  • SHIPPING
  • options.shipping.feeAmount String N Shipping fee
    options.shipping.feeInquiryUrl String 500 N A URL to check shipping method
    options.shipping.feeInquiryType String N Shipping fee options
  • CONDITION : Check the shipping method (fee) when the shipping address is changed.
  • FIXED : If fixed, not checking the shipping address even after it is changed.
  • options.shipping.address.country String 2 N Shipping country
    options.shipping.address.postalCode String 10 N Shipping postal code
    options.shipping.address.state String 100 N Shipping region
    options.shipping.address.city String 100 N Shipping address
    options.shipping.address.detail String 1000 N Shipping detail
    options.shipping.address.optional String 1000 N Additional information of the shipping address
    options.shipping.address.recipient.firstName String 200 N Recipient name
    options.shipping.address.recipient.lastName String 200 N Recipient last name
    options.shipping.address.recipient.firstNameOptional String 200 N Additional information of the recipient first name
    options.shipping.address.recipient.lastNameOptional String 200 N Additional information of the recipient last name
    options.shipping.address.recipient.email String 100 N Email of the recipient
    options.shipping.address.recipient.phoneNo String 100 N Phone number of the recipient
    options.familyService.addFriends[].type String N Service type of the friend add list
  • lineAt
  • options.familyService.addFriends[].idList[] List N A list of ID by service
    options.extra.branchName String 2000 N Branch Name where the payment is requested from (Only 100 letters will be displayed if it's exceeded.)
    options.extra.branchId String 32 N Branch Id where the payment is requested.
    It can be support alphabets, numbers and special characters.

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message
    info.transactionId Number 19 Transaction ID
    info.paymentAccessToken String 12 The code value entered when code is used instead of scanner in the LINE Pay.
    info.paymentUrl.app String 300 App URL to move to the payment page
  • Used when payment reservation is done in the app
  • URL to move from the merchant app to the LINE Pay.
  • info.paymentUrl.web String 300 Web URL to move to the payment page
  • Used when payment reservation is done in the web
  • URL to move to the LINE Pay payment standby page
  • Move to URL that is delivered without particular parameter
  • If opening a pop-up in the desktop, follow the size: Width: 700px, Height : 546px
  • Return Codes

    Code Description
    0000 Success
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header information error
    1124 An amount info error
    1145 Payment in process
    1172 A record of transaction with the same order number already exists.
    1178 Unsupported currency
    1183 The payment amount must be less than 0.
    1194 The merchant cannot use the preapproved payment.
    2101 A parameter error
    2102 A JSON data format error
    9000 An internal error

    Request Details

    Product

    The payment order can be comprised of rich information with packages and products. A package refers to shipping unit and the package can be comprised of various products.

    RedirectUrls.confirmUrl

    After user approves the payment request, the ConfirmURL is called automatically. The call of ConfirmURL informs the merchant that the payment can be completed with the Confirm API after the approval. The call also have a screen with payment process status provided to users who are in between approval to payment completion.

    RedirectUrls.cancelUrl

    If user cancels the payment while processing with LINE Pay, the page moves to the cancellation page using the CancelURL sent through the Request API. At here, transactionID and orderID are also added and sent.

    confirmUrlType

    The following are ConfirmURL options to choose after user completes the payment request.

    To complete the payment from user page, move to the completion page through the merchant ConfirmURL.

    Call the ConfirmURL from the LINE Pay server to the merchant server.

    Must use https protocol, and in real environment use a trustworthy authentication.

    The ConfirmURL is not used for cases, such as offline, that does not require to show the payment completion page. The merchant should regularly check the Payment Status API to check the user approval.

    Options

    LINE Pay provides various payment methods and features in the family service. Use the services by setting fields in 'Options'.

    Payment

    Setting payment options

    payType

    General payment

    Automatic payment

    Display

    User payment page and user payment flow settings are provided.

    Locale

    Supported languages in the payment standby page displayed to user

    FamilyService

    The following describes about supported features in the LINE Family services provided by LINE Pay.

    addFriends

    Add friends feature of LINE@

    Example

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

    Provides the add friends feature between the merchant LINE account and LINE pay user account.

    Sample

    General payment

    
    {
        "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 payment

    
    {
        "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"
            }
        }
    }
    
    
    

    Automatic payment

    
    {
        "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

    An API for the merchant to complete the payment when the user approves with the ConfirmURL or Check Payment Status API. Status of a payment where authorization and purchase are separated because 'options.payment.capture' of the Request API is set as false will be in purchase standby (Authentication) even after it is completed. To complete the purchase, an additional purchase process is required through the Capture API.

    API Spec

    POST /v3/payments/{transactionId}/confirm

    Request Body

    Item Data type Length Requirement Description
    amount number Y Payment amount
    currency String 3 Y Payment currency (ISO 4217)
    Supported currencies are as follows.
    • USD
    • JPY
    • TWD
    • THB

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message
    info.orderId String 100 An unique order ID of the merchant sent upon requesting the payment.
    info.transactionId Number A transaction ID returned as the payment request result (19 digits).
    info.authorizationExpireDate String 30 Option: Authentication expiration date and time (ISO 8601)
    • Send if the payment proceeded only up to authentication (capture=false)
    info.regKey String 15 Option: A key for automatic payment (15 digits)
    info.payInfo[].method String 20 A payment method used for payment
    • Credit card: CREDIT_CARD
    • Balance: BALANCE
    • Discount: DISCOUNT
    info.payInfo[].amount Number Payment amount
    info.payInfo[].creditCardNickname String 100 Option: Credit card nickname for automatic payment
    • Credit card name managed at LINE Pay. It is the name registered when registered to LINE Pay.
    • If LINE Pay user does not set a nickname, an empty string will be sent.
    • The nickname can be changed upon user's request and the change history will not be shared with the merchant.
    info.payInfo[].creditCardBrand String 20 Option: Credit card brand used for automatic payment
    • VISA
    • MASTER
    • AMEX
    • DINERS
    • JCB
    info.payInfo[].maskedCreditCardNumber String 17 Masked credit card number (Send only for Taiwan merchants. Able to use the feature when requesting to the merchant center manager).
  • Format: **** **** **** 1234
  • info.packages[].id String 50 An unique ID of package list
    info.packages[].name String 4000 Name of the sales products
    info.packages[].amount Number Total amount of products per package
    =sum(products[].quantity * products[].price)
    info.packages[].userFeeAmount Number User fee: Sent as a respond if a list of fee is found within the payment amount.
    info.shipping.methodId String 50 An ID of shipping method selected by user
    info.shipping.feeAmount Number Shipping fee
    info.shipping.address.country String 2 Shipping country
    info.shipping.address.postalCode String 10 Shipping postal code
    info.shipping.address.state String 100 Shipping region
    info.shipping.address.city String 100 Shipping address
    info.shipping.address.detail String 1000 Shipping detail
    info.shipping.address.optional String 1000 Additional information of the shipping address
    info.shipping.address.recipient.firstName String 200 Recipient first name
    info.shipping.address.recipient.lastName String 200 Recipient last name
    info.shipping.address.recipient.firstNameOptional String 200 Additional information of the recipient first name
    info.shipping.address.recipient.lastNameOptional String 200 Additional information of the recipient last name
    info.shipping.address.recipient.email String 100 Email of the recipient
    info.shipping.address.recipient.phoneNo String 50 Phone number of the recipient

    Return Codes

    Code Description
    0000 Success
    1101 Not a LINE Pay member
    1102 The member is unable to proceed the transaction.
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header info error
    1110 Unacceptable credit card
    1124 Amount info error (scale)
    1141 A payment account error
    1142 Low balance
    1150 Cannot find the transaction history
    1152 There is a history of transactions with the same transactionId.
    1153 The payment amount is different than the requested amount.
    1159 Payment request information is not found.
    1169 Must select a payment method and password authorization at the LINE Pay.
    1170 Balance of the member's account has been changed.
    1172 A record of transaction with the same order number already exists.
    1180 The payment has been expired.
    1198 API call request has been duplicated.
    1199 Internal request error
    1280 A temporary error occurred while processing the credit card payment.
    1281 A credit card payment error
    1282 A credit card authorization error
    1283 The payment was refused due to suspected fraud.
    1284 The credit card payment has temporarily stopped.
    1285 Missing credit card payment information
    1286 Wrong credit card payment information
    1287 The credit card has been expired
    1288 The credit card has low balance
    1289 Exceeded the credit card limit
    1290 Exceeded the limit of the credit card per payment
    1291 The card has been reported as a stolen card.
    1292 The card has been suspended.
    1293 A CVN input error
    1294 The card is listed on the blacklist.
    1295 A wrong credit card number
    1296 Unable to proceed the amount
    1298 The card has been declined.
    9000 An internal error

    Sample

    Example of requesting the 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

    If payType is NORMAL, pay with balance

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

    Capture API

    Transactions that have set options.payment.capture as false when requesting the Request API payment will be put on hold when the payment is completed with the Confirm API. In order to finalize the payment, an additional purchase with Capture API is required.

    API Spec

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

    Request Body

    Item Data type Requirement Description
    amount number Y Payment amount
    currency String(3byte) Y Payment currency (ISO 4217)
    Supported currencies are as follows.
    • USD
    • JPY
    • TWD
    • THB

    Response Body

    Item Data type Description
    returnCode String(4byte) Return code
    returnMessage String Return message or reason for failure. The following are examples.
    • Unpayable merchant
    • Merchant authorization information error
    info.orderId String An order ID sent from the merchant when reservating a payment.
    info.transactionId number A transaction ID returned as the payment reservation result (19 digits).
    info[].payInfo[].method String A payment method used to proccess the payment
    • Credit card: CREDIT_CARD
    • Balance: BALANCE
    • Discount: DISCOUNT
    info.payInfo[].amount number Payment amount

    Return Codes

    Code Description
    0000 Success
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header info error
    1150 Cannot find the transaction history
    1155 Wrong transaction number
    1170 Balance of the member's account has been changed.
    1172 A record of transaction with the same order number already exists.
    1179 Unable to proceed the transaction.
    1183 The payment amount should be greater than 0.
    1184 The payment amount exceeds requested amount.
    1198 Either API call has be duplicated or purchase API has been called while re-authorization was automatically processed (Repeat after several minutes).
    1199 Internal request error
    1280 A temporary error occurred while processing the credit card payment.
    1281 A credit card payment error
    1282 A credit card authorization error
    1283 The payment was refused due to suspected fraud.
    1284 The credit card payment has temporarily stopped.
    1285 Missing credit card payment information
    1286 Wrong credit card payment information
    1287 The credit card has been expired
    1288 The credit card has low balance
    1289 Exceeded the credit card limit
    1290 Exceeded the limit of the credit card per payment
    1291 The card has been reported as a stolen card.
    1292 The card has been suspended.
    1293 A CVN input error
    1294 The card is listed on the blacklist.
    1295 A wrong credit card number
    1296 Unable to proceed the amount
    1298 The card has been declined.
    9000 An internal error

    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

    An API to void payment data that are in authentication status. The API cancels authentication transaction since the payment is completed with the Confirm API. Only the transactions that are in authentication status can be cancelled and purchased transactions should be refunded with Refund API.

    API Spec

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

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message or reason for failure. The following are examples.
    • Unpayable merchant
    • Merchant authentication information error

    Return Codes

    Code Description
    0000 Success
    1101 A purchaser status error
    1102 A purchaser status error
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header info error
    1150 Cannot find the transaction history
    1155 Wrong transaction number
    1165 A transaction has already been voided.
    1170 Balance of the member's account has been changed.
    1198 API call request has been duplicated.
    1199 An internal request error
    1900 A temporary error. Please try again later.
    1902 A temporary error. Please try again later.
    1999 The request information is different than the previous one.
    9000 An internal error

    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

    An API to refund transactions that has been completed the payment (purchase). The transaction ID of LINE Pay user must be passed when refunded and partial refund is also possible.

    API Spec

    POST /v3/payments/{transactionId}/refund

    Request Body

    Item Data type Requirement Description
    refundAmount number N Refund amount
    • Full refund if not returned

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message or reason for failure
    info.refundTransactionId number Refund transaction ID (Newly issued, 19 digits)
    info.refundTransactionDate String 30 Refund transaction date (ISO 8601)

    Return Codes

    Code Description
    0000 Success
    1101 A purchaser status error
    1102 A purchaser status error
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header information error
    1124 An account status error
    1150 Cannot find the transaction history
    1155 Number of a transaction type that cannot be refunded.
    1163 Unable to refund since refundable date is over.
    1164 Exceeded refundable amount.
    1165 A transaction already been refunded.
    1179 Unable to proceed the transaction.
    1198 The API call request has been duplicated.
    1199 An internal request error
    9000 An internal request

    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

    An API to check transaction history in LINE Pay. You can check histories of authentications and payment completions. With fields setting, you can selectively check transaction information or order information as needed.

    API Spec

    GET /v3/payments

    Request Parameter

    Item Data type Requirement Description
    transactionId[] number N Payment or refund transaction ID generated by LINE Pay
    orderId[] String N Order ID of the merchant
    fields String N Able to select targets to check
  • TRANSACTION
  • ORDER
    Default is ALL
  • Payment Check Response

    Response Body

    Common information

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 100 Return message or reason for failure

    When checking the Transaction type, the responses are:

    Item Data type Length Description
    info[].transactionId number Transaction ID (19 digits)
    info[].transactionDate String 20 Transaction date(ISO-8601)
    info[].transactionType String Transaction options:
    • PAYMENT: Payment
    • PAYMENT_REFUND: Refund
    • PARTIAL_REFUND: Partial refund
    info[].payStatus String 20 Payment status
    • CAPTURE:capture
    • AUTHORIZATION: Authorization
    • VOIDED_AUTHORIZATION: Voided authorization (Called 'Void authorization API')
    • EXPIRED_AUTHORIZATION: Expired authorization (When expiration date given to merchants by LINE Pay has been expired).
    info[].productName String 4000 Product name
    info[].merchantName String Merchant name
    info[].currency String 3 Currency (ISO 4217)
    info[].authorizationExpireDate String 20 Expiration date of authorization (ISO-8601)
    info[].payInfo[].method String A payment method used for payment
    • Credit card: CREDIT_CARD
    • Balance: BALANCE
    • Discount: DISCOUNT
    info[].payInfo[].amount number Transaction amount (Amount when generating the transaction ID)
    Calculating method of the final transaction amount when checking the original transaction:
    sum(info[].payInfo[].amount) – sum(refundList[].refundAmount)

    In case of checking the Transaction type when original and refund transactions are available

    Item Data type Description
    info[].refundList[].refundTransactionId number Refund transaction ID (19 digits)
    info[].refundList[].transactionType String Transaction options:
    • PAYMENT_REFUND: Refund
    • PARTIAL_REFUND: Partial refund
    info[].refundList[].refundAmount number Refund amount
    info[].refundList[].refundTransactionDate String Date of refund transaction (ISO-8601)

    In case of checking the Transaction type when checking the refund transaction

    Item Data type Description
    info[].originalTransactionId number Original transaction ID (19 digits)

    In case of checking the Order type

    Item Data type Length Description
    info[].packages[].id String 50 An unique ID of package list
    info[].packages[].amount Number Total amount of products per package
    =sum(products[].quantity * products[].price)
    info[].packages[].userFeeAmount Number User fee: Respond if an comission item is found within the payment amount.
    info[].packages[].name String 100 Name of the package or name of internal shops
    info[].packages[].products[].id String 50 ID of sales products of the merchant
    info[].packages[].products[].name String 4000 Name of the sales products
    info[].packages[].products[].imageUrl String 500 Image URL of the sales products
    info[].packages[].products[].quantity Number Number of the products
    info[].packages[].products[].price Number Price of each product
    info[].packages[].products[].originalPrice Number Original price of each product
    info[].shipping.methodId String 50 Shipping method ID selected by user
    info[].shipping.feeAmount Number Shipping fee
    info[].shipping.address.country String 2 Shipping country
    info[].shipping.address.postalCode String 10 Shipping postal code
    info[].shipping.address.state String 100 Shipping region
    info[].shipping.address.city String 100 Shipping address
    info[].shipping.address.detail String 1000 Shipping detail
    info[].shipping.address.optional String 1000 Additional information of the shipping information
    info[].shipping.address.recipient.firstName String 200 Recipient first name
    info[].shipping.address.recipient.lastName String 200 Recipient last name
    info[].shipping.address.recipient.firstNameOptional String 200 Additional information of the recipient first name
    info[].shipping.address.recipient.lastNameOptional String 200 Additional information of the recipient last name
    info[].shipping.address.recipient.email String 100 Email of the recipient
    info[].shipping.address.recipient.phoneNo String 50 Phone number of the recipient

    In case of checking the events type

    Item Data type Length Description
    info[].events[].code String 30 Unique event code which allows only alphanumeric.
    info[].events[].totalAmount Number Amount to be applied to rate promotion.
    info[].events[].productQuantity Number Amount to be applied to fixed promotion.

    Return Codes

    Code Description
    0000 Success
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header info error
    1150 Cannot find the transaction history
    1177 Exceeded maximum viewable transactions (Max. 100)
    9000 An internal error

    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

    When checking payment transactions

    
    
    {
        "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-06T11: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"
                     }
                 }
             }
        }]
     }
    
    

    When checking refund transactions

    
    {
        "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
        }]
     }
    
    

    When checking events transactions

    
    {
        "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,
           "events": [
             {
               "code": "alphanumeric",
               "totalAmount": 500,
               "productQuantity": null
             },
             {
               "code": "alphanumeric2",
               "totalAmount": null,
               "productQuantity": 10
             }
           ]
        }]
     }
    
    

    Check Payment Status API

    An API to check payment request status of LINE Pay. The merchant should regularly check user payment confirm status without using the ConfirmURL and decide if it is possible to complete the payment.

    API Spec

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

    Check Response

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 100 Return message or reason for failure
    info.shipping.methodId String 50 An ID of shipping method selected by user
    info.shipping.feeAmount Number Shipping fee

    Return Code

    Code Description
    0000 Before authorization
    0110 Completed authorization - Able to call the Confirm API
    0121 Payment canceled by user or because of timeout (20min). - Completed status
    0122 Payment failed - Completed status
    0123 Payment completed - Completed status
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    9000 An 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 - General payment

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

    Response - Checkout payment

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

    Check RegKey API

    An API to check issued RegKey status

    API Spec

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

    Parameter

    Item Data type Length Requirement Description
    creditCardAuth Boolean N Whether credit cards issued with RegKey have authorized minimum amount
    • True : Through LINE Pay verification and authentication of minimum amount of credit card, check the status of RegKey. It requires review from the LINE Pay manager.
    • False : Check the RegKey status with LINE Pay verification.

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message

    Return Codes

    Code Description
    0000 Success
    1101 A purchaser status error
    1102 A purchaser status error
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header information error
    1141 An account status error
    1154 Unavailable preapproved payment account
    1190 The regKey does not exist
    1193 The regKey has been expired

    Sample

    Example of Pay Preapproved API request

    
    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

    An automatic payment registration process is required using Request API and Confirm API. With RegKey sent through the Confirm API, the payment can be processed without use approval.

    API Spec

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

    Request Body

    Item Data type Length Requirement Description
    productName String 4000 Y Product name
    amount number Y Payment amount
    currency String 3 Y Payment currency (ISO 4217)
    Supported currencies are as follows.
    • USD
    • JPY
    • TWD
    • THB
    orderId String 100 Y An unique order ID
    capture Boolean N Purchasement
    • True : Authorized and purchased
    • False : Authorized but need to purchase with Capture API

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message
    info.orderId String 100 An unique order ID sent upon requesting for payment.
    info.transactionId Number A transaction ID returned as the payment reservation result (19 digits).
    info.transactionDate String 30 Transaction date (ISO 8601)
    info.authorizationExpireDate String 30 Expiration date (ISO 8601)

    Return Codes

    Code Description
    Code Description
    ---- ------------------------------------------------------
    0000 Success
    1101 Not a LINE Pay member
    1102 The member is unable to proceed the transaction.
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header info error
    1110 Unacceptable credit card
    1124 Amount info error (scale)
    1141 A payment account error
    1142 Low balance
    1150 Cannot find the transaction history
    1152 There is a history of transactions with the same transactionId.
    1153 The payment amount is different than the requested amount.
    1159 Payment request information is not found.
    1169 Must select a payment method and password authorization at the LINE Pay.
    1170 Balance of the member's account has been changed.
    1172 A record of transaction with the same order number already exists.
    1180 The payment has been expired.
    1198 API call request has been duplicated.
    1199 An internal request error
    1280 A temporary error occurred while processing the credit card payment.
    1281 A credit card payment error
    1282 A credit card authorization error
    1283 The payment was refused due to suspected fraud.
    1284 The credit card payment has temporarily stopped.
    1285 Missing credit card payment information
    1286 Wrong credit card payment information
    1287 The credit card has been expired
    1288 The credit card has low balance
    1289 Exceeded the credit card limit
    1290 Exceeded the limit of the credit card per payment
    1291 The card has been reported as a stolen card.
    1292 The card has been suspended.
    1293 A CVN input error
    1294 The card is listed on the blacklist.
    1295 A wrong credit card number
    1296 Unable to proceed the amount
    1298 The card has been declined.
    9000 An internal error

    Sample

    Example of Pay Preapproved API request

    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 : Example of true response

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

    Capture : Example of false response

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

    Expire RegKey API

    An API to expire issued RegKey

    API Spec

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

    Response Body

    Item Data type Length Description
    returnCode String 4 Return code
    returnMessage String 300 Return message

    Return Codes

    Code Description
    0000 Success
    1104 Non-existing merchant
    1105 The merchant cannot use the LINE Pay.
    1106 A header information error
    1190 The regKey does not exist
    1193 The regKey has been expired

    Sample

    Example of Pay Preapproved API request

    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

    This following describes about API (or page URL) that should be provided by merchants to LINE Pay. The merchant API must use reliable authentication and HTTPS protocol. Also, the authentication must use TLS version above 1.2 for security reason.

    A list of access control

    If the API provided by the merchant manages access control with IP, must add the following LINE Pay Server IP by environment.

    confirmURL Spec

    The merchant must provide the ConfirmURL spec in page or API according to its type. Once user approves the payment, the LINE Pay app shows the merchant's payment process page to user through the ConfirmURL and notice the merchant about the approval. The ConfirmURL plays a role of the bridge page that moves to payment completion page through the Confirm API. However, for special payment method that does not require to show payment page to user, you can proceed with HTTP status 200 response.

    List of APIs

    Item Description
    Protocol HTTP
    Method GET
    Request timeout Connection: 5 seconds
    Read: 20 seconds

    Request Parameters

    Parameter Requirement Description
    orderId Y An order ID sent from the merchant when payment is requested
    transactionId Y Transaction ID received as a result of the request
    shippingFeeAmount N Shipping fee of checkout
    shippingMethodId N An ID selected as shipping method of merchant

    While LINE Pay makes decision on success or failure as HTTP response code, the merchant should not send additional information as a response. If the HTTP response code is not a success (200 OK), notice the payment failure to LINE Pay user.

    Response

    Sample

    Request Suppose the ConfirmURL provided by the merchant is '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

    When user cancels the payment while processing it on LINE Pay app payment page, use cancelURL sent through the Request API to move to the merchant page. If transactionId and orderId are not found in query string of the cancelURL, the payment will be automatically cancelled and returned.

    Inquiry ShippingMethods API

    Merchants using the checkout are required to implement and provide the ShippingMethods API spec to LINE Pay through the Request API. Once user designates a shipping address, check the shipping possibility, shipping method, and fee through the API based on the entered postal code. The shipping method and fee selected by user will be sent to the merchant through the ConfirmURL.

    List of APIs

    Item Description
    Protocol HTTP
    Method POST
    Request timeout Connection: 5 seconds
    Read: 20 seconds

    Request

    Key Value Desc
    Content-Type application/json
    Parameter Data type Length Requirement Description
    currency String 3 Y Currency of shipping fee
    orderId String 100 Y Order ID sent from the merchant when requesting the payment
    transactionId Number Y Transaction ID returned as a result of the payment request
    shippingAddress.country String 2 N Shipping country
    shippingAddress.postalCode String 10 N Shipping postal code
    shippingAddress.state String 100 N Shipping state
    shippingAddress.city String 300 N Shipping city

    Response Body

    Parameter Data type Length Requirement Description
    returnCode String 3 Y Return code
    returnMessage String 100 N Return message
    info.shippingMethods[].id String Y Shipping method ID of the merchant
    info.shippingMethods[].name String 100 Y Name of the shipping method
    info.shippingMethods[].amount Number Y Shipping fee
    info.shippingMethods[].toDeliveryYmd String 8 N Expected shipping date (YYYYMMDD)
    info.shippingMethods[].fromDeliveryHm String 4 N (HHmm) Expected starting time of shipping
    info.shippingMethods[].toDeliveryHm String 4 N (HHmm) Expected end time of shipping

    Return Codes

    Code Description
    0000 Success
    4001 Unsupported shipping region
    4002 Wrong shipping address
    5001 Internal server error(Unknown error)
    9999 System maintainance

    Sample

    Response

    When there is no shipping date

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

    Example of user message

    
    FAST POST - 500
    
    

    When there is only shipping completion date without designated time

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

    Example of user message

    
    FAST POST - 500
    2018/10/30 No designated time
    
    

    When shipping completion date, shipping starting time, and end time are provided

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

    Example of user message

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

    Appendix

    LINE Pay error codes

    Defining error codes that may occur in the LINE Pay.

    The return messages of the error codes are in English and a hyphen(-) is sent when the message is sent without a message.

    Coce Description
    1101 Not a LINE Pay member
    1102 The member is unable to proceed the transaction.
    1104 The store is not one of the affiliated store.
    1105 The affiliated store cannot use the LINE Pay.
    1106 A header info error
    1110 The credit card cannot be used
    1124 Amount info error (scale)
    1141 Payment account status error
    1142 Low balance
    1145 Payment in process
    1150 Transaction history does not exist
    1152 There is a history of transactions with the same transactionId.
    1153 The payment amount is different than the requested amount.
    1154 Unable to use the payment method set up for the automatic payment.
    1155 Transaction number of a transaction type that cannot be refunded.
    1159 Payment request information is not found.
    1163 Unable to refund since refundable date is over.
    1164 Exceeded refundable amount.
    1165 A transaction already been refunded.
    1169 Error on information required for payment confirmation (Must select a payment method and password authorization at the LINE Pay).
    1170 Balance of the member's account has been changed.
    1172 There is a record of transaction with the same order number.
    1177 Exceeded maximum number of viewable transaction (Max. 100).
    1178 The currency is not supported by the store.
    1179 Unable to proceed the transaction.
    1180 The payment is expired.
    1183 The payment amount should be greater than 0.
    1184 The payment amount exceeds requested amount.
    1190 The regKey is unavailable.
    1193 The regKey is expired.
    1194 The store cannot use automatic payment.
    1197 Already processing the payment with the regKey.
    1198 Processing the request
    1199 Internal request error
    1280 A temporary error occurred while processing the credit card payment.
    1281 Credit card payment error
    1282 Credit card authorization error
    1283 The payment was refused due to suspected fraud.
    1284 The credit card payment is temporarily stopped.
    1285 Missing credit card payment information
    1286 Invalid credit card payment information
    1287 The credit card is expired
    1288 The credit card has low balance
    1289 Exceeded the credit card limit
    1290 Exceeded the limit of the credit card per payment
    1291 The card has been reported as a stolen card.
    1292 The card has been suspended.
    1293 CVN input error
    1294 The card is listed on the blacklist.
    1295 Wrong credit card number
    1296 Unable to proceed the amount
    1298 The card has been declined.
    2101 A parameter error
    2102 JSON data format error
    9000 An internal error

    PaymentUrl Guide

    The following guide describes how to move from LINE app to app after a payment is requested from an affiliated store app.

    Android Sample

    With the following sample code, you can check if the LINE app is installed and which LINE Pay versions are available. If the app is installed and versions are checked, move to the LINE Pay payment page.

    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

    With the following sample code, you can verify if the LINE app is installed. If the app is installed, move to the LINE Pay payment page.

    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

    Using Sandbox

    LINE Pay supports Sandbox environment. To run a payment test in the Sandbox environment, use an endpoint dedicated for Sandbox found from the list of API Endpoint which is provided on the integration guide. For the test, confirmUrl and Inquiry ShippingMethods API are required.

    When attempting payment in the Sandbox environment, it proceeds as described as below.

    Sandbox PC Payment

    Sandbox pc payment process

    Sandbox Mobile Payment

    Sandbox mobile payment process

    Note

    The Sandbox environment requires channel log-in from both PC and mobile. However, when integrating with real server, you are not required to access to the LINE app to channel log-in on mobile.

    Migration API V3

    The updates in Payment API v3 are the change from API authorization to HMAC signature verification and the Request API.

    Authentication

    The ID and password authentication method in Paymen API v2 has been changed to HMAC authentication and message verification in v3.

    Keep X-LINE-ChannelSecret that has been sent as password of v2 and use the SecretKey to generate the HMAC signature.

    You can secure the signature security by designating randomly generated one-time values to X-LINE-Authorization-Nonce. Refer to API Authentication for more details.

    Http Request Headers

    Header Version 2 Version 3 Description
    X-LINE-ChannelId O O No change
    X-LINE-ChannelSecret O X Delete
    X-LINE-MerchantDeviceProfileId O O No change
    X-LINE-Authorization-Nonce X O New
    X-LINE-Authorization X O New

    Request API

    The biggest upgrade in v3 is that the API provides abundant amount of product and order information to user and also allowing convenient use of the checkout feature with the LINE user information.

    productName and productImageUrl that were defined on a single product in v2 are upgraded with package[] in v3 so that better information about the product can be provided to user.

    options.shipping is defined for the checkout feature. Refer to Request API for more details.

    Request Body Mapping

    Version 2 Version 3 Description
    amount amount No change
    currency currency No change
    orderId orderId No change
    packages[].id New
    packages[].amount New
    packages[].userFee New
    packages[].name New
    packages[].products[].id Single item -> Multiple item
    productName packages[].products[].name Single item -> Multiple item
    productImageUrl packages[].products[].imageUrl Single item -> Multiple item
    packages[].products[].quantity New
    packages[].products[].price New
    packages[].products[].originalPrice New
    packageName redirectUrls.appPackageName Name change
    confirmUrl redirectUrls.confirmUrl
    confirmUrlType redirectUrls.confirmUrlType
    cancelUrl redirectUrls.cancelUrl
    capture options.payment.capture
    payType options.payment.payType
    langCd options.display.locale Name change
    checkConfirmUrlBrowser options.display.checkConfirmUrlBrowser
    extras.addFriends[].type options.familyService.addFriends[].type
    extras.addFriends[].idList[] options.familyService.addFriends[].idList[]
    options.shipping.* New