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
Code | Description |
---|---|
0000 | Success |
Error
Code | Description |
---|---|
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 |
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)
)