Refund API

Overview

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.

send

send(refundRequestConfig)

Returns Promise<ApiResponse<RefundResponseBody>>

Request Config

export type RefundRequestBody = {
  /**
   * Refund amount
   * - Full refund if not returned
   */
  refundAmount: number
}

export type RefundRequestConfig = GeneralRequestConfig & {
  /**
   * ID of the transaction
   */
  transactionId: string
  /**
   * Request body of refund API
   */
  body: RefundRequestBody
}

Response Body

export type Info = {
  /**
   * Refund transaction ID (Newly issued, 19 digits)
   */
  refundTransactionId: string
  /**
   * Refund transaction date (ISO 8601)
   */
  refundTransactionDate: string
}

export type RefundResponseBody = GeneralResponseBody & {
  /**
   * Refund information
   */
  info: Info
}

Return Code

Success

CodeDescription
0000Success

Error

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

Example

Request

const res = await linePayClient.refund
  .send({
    transactionId: '2021121300698360310',
    body: {
      refundAmount: 20
    }
  })

Response

{
  "body": {
    "returnCode": "0000",
    "returnMessage": "Success.",
    "info": {
      "refundTransactionId": "2021121600698710312",
      "refundTransactionDate": "2021-12-16T00:50:15Z"
    }
  },
  "comments": {}
}

addHandler

addHandler(handler)

Returns RefundClient

Example:

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

addHandlers

addHandlers(...handlers)

Returns RefundClient

Example:

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