Pay Preapproved API

Overview

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

send

send(payPreapprovedRequestConfig)

Returns Promise<ApiResponse<PayPreapprovedResponseBody>>

Request Config

export type PayPreapprovedRequestBody = {
  /**
   * Product name
   */
  productName: string
  /**
   * Product amount
   */
  amount: number
  /**
   * Payment currency ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217))\
   * Supported currencies are as follows.
   * - USD
   * - JPY
   * - TWD
   * - THB
   */
  currency: string
  /**
   * An unique order ID
   */
  orderId: string
  /**
   * Purchasement
   * - True : Authorized and purchased
   * - False : Authorized but need to purchase with Capture API
   */
  capture?: boolean
}

export type PayPreapprovedRequestConfig = GeneralRequestConfig & {
  /**
   * A key used for automatic payment
   */
  regKey: string
  /**
   * Request body of payPreapproved API
   */
  body: PayPreapprovedRequestBody
}

Response Body

export type Info = {
  /**
   * An unique order ID sent upon requesting for payment.
   */
  orderId: string
  /**
   * A transaction ID returned as the payment reservation result (19 digits).
   */
  transactionId: string
  /**
   * Transaction date ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601))
   */
  transactionDate: string
  /**
   * Expiration date ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601))
   */
  authorizationExpireDate?: string
}

export type PayPreapprovedResponseBody = GeneralResponseBody & {
  /**
   * PayPreapproved information
   */
  info: Info
}

Return Code

Success

CodeDescription
0000Success

Error

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

Example

Request

const res = await linePayClient.payPreapproved.send({
  regKey: 'RK9A2BA1937EQTO',
  body: {
    productName: 'Demo Product',
    amount: 100,
    currency: 'TWD',
    orderId: '20211221001'
  }
})

Response

{
  "body": {
    "returnCode": "0000",
    "returnMessage": "Success.",
    "info": {
      "transactionId": "2021123112345678910",
      "transactionDate": "2021-12-31T09:00:31Z"
    }
  },
  "comments": {}
}

addHandler

addHandler(handler)

Returns PayPreapprovedClient

Example:

client.addHandler(({ type, req, next, httpClient }) => {
  console.log(type) // payPreapproved
  return next(req)
})

addHandlers

addHandlers(...handlers)

Returns PayPreapprovedClient

Example:

client.addHandlers(
  ({ req, next }) => next(req),
  ({ req, next }) => next(req),
  ({ req, next }) => next(req)
)
Last Updated:
Contributors: Sean Lin