Payment Details API
Overview
An API to check transaction history in LINE Pay. You can check histories of authorizations and payment completions. With fields setting, you can selectively check transaction information or order information as needed.
send
send(paymentDetailsRequestConfig)
Returns Promise<ApiResponse<PaymentDetailsResponseBody>>
Request Config
export type Fields = 'ALL' | 'TRANSACTION' | 'ORDER'
export type PaymentDetailsRequestParams = {
/**
* Payment or refund transaction ID generated by LINE Pay
*/
transactionId?: string[]
/**
* Order ID of the merchant
*/
orderId?: string[]
/**
* Able to select targets to check
* - TRANSACTION
* - ORDER
* - ALL
*
* Default is ALL
*/
fields?: Fields
}
export type PaymentDetailsRequestConfig = GeneralRequestConfig & {
/**
* Request parameters of payment detail API
*/
params: PaymentDetailsRequestParams
}
Response Body
export type PayInfo = {
/**
* A payment method used for payment
* - Credit card: CREDIT_CARD
* - Balance: BALANCE
* - Discount: DISCOUNT
*/
method: string
/**
* 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)`
*/
amount: number
}
export type Refund = {
/**
* Refund transaction ID (19 digits)
*/
refundTransactionId: string
/**
* Transaction options:
* - PAYMENT_REFUND: Refund
* - PARTIAL_REFUND: Partial refund
*/
transactionType: string
/**
* Refund amount
*/
refundAmount: number
/**
* Date of refund transaction ([ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))
*/
refundTransactionDate: string
}
export type Shipping = {
/**
* Shipping method ID selected by user
*/
methodId: string
/**
* Shipping fee
*/
feeAmount: number
/**
* Address of the shipping
*/
address: Address
}
export type Package = {
/**
* An unique ID of package list
*/
id: string
/**
* Total amount of products per package\
* `=sum(products[].quantity * products[].price)`
*/
amount: number
/**
* User fee: Respond if a commission is found within the payment amount.
*/
userFeeAmount?: number
/**
* Name of the package or name of internal shops
*/
name?: string
/**
* products in the package
*/
products: Product[]
}
export type Event = {
/**
* Unique event code which allows only alphanumeric.
*/
code: string
/**
* Amount to be applied to rate promotion.
*/
totalAmount: number
/**
* Amount to be applied to fixed promotion.
*/
productQuantity: number
}
export type Info = {
/**
* Transaction ID (19 digits)
*/
transactionId: string
/**
* An unique order ID of the merchant sent upon requesting the payment.
*/
orderId: string
/**
* Transaction date([ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))
*/
transactionDate: string
/**
* Transaction options:
* - PAYMENT: Payment
* - PAYMENT_REFUND: Refund
* - PARTIAL_REFUND: Partial refund
*/
transactionType: string
/**
* 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).
*/
payStatus: string
/**
* Product name
*/
productName: string
/**
* Merchant name
*/
merchantName: string
/**
* Currency (ISO 4217)
*/
currency: string
/**
* Expiration date of authorization ([ISO-8601](https://en.wikipedia.org/wiki/ISO_8601))
*/
authorizationExpireDate: string
/**
* Payment information
*/
payInfo: PayInfo[]
/**
* Refund list\
* In case of checking the `Transaction` type when original and refund transactions are available
*/
refundList?: Refund[]
/**
* Original transaction ID (19 digits)
*/
originalTransactionId?: number
/**
* Package list
*/
packages: Package[]
/**
* Shipping information
*/
shipping?: Shipping
/**
* Event list
*/
events?: Event[]
}
export type PaymentDetailsResponseBody = GeneralResponseBody & {
/**
* Payment details information
*/
info: Info[]
}
Return Code
Success
Code | Description |
---|---|
0000 | Success |
Error
Code | Description |
---|---|
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 |
Example
Request
const res = await linePayClient.paymentDetails
.send({
params: {
transactionId: ['2021121600698709510']
}
})
Response
{
"body": {
"returnCode": "0000",
"returnMessage": "Success.",
"info": [
{
"transactionId": "2021121600698709510",
"transactionDate": "2021-12-16T00:27:40Z",
"transactionType": "PAYMENT",
"productName": "Demo Product",
"currency": "TWD",
"authorizationExpireDate": "2021-12-16T00:27:40Z",
"payInfo": [
{
"method": "CREDIT_CARD",
"amount": 1000
}
],
"refundList": [
{
"refundTransactionId": "2021121600698710312",
"transactionType": "PARTIAL_REFUND",
"refundAmount": -20,
"refundTransactionDate": "2021-12-16T00:50:15Z"
}
],
"orderId": "20211216002",
"payStatus": "CAPTURE",
"packages": [
{
"id": "c99abc79-3b29-4f40-8851-bc618ca57857",
"amount": 1000,
"userFeeAmount": 0,
"products": [
{
"name": "Demo Product",
"quantity": 2,
"price": 500
}
]
}
]
}
]
},
"comments": {}
}
addHandler
addHandler(handler)
Returns PaymentDetailsClient
Example:
client.addHandler(({ type, req, next, httpClient }) => {
console.log(type) // paymentDetails
return next(req)
})
addHandlers
addHandlers(...handlers)
Returns PaymentDetailsClient
Example:
client.addHandlers(
({ req, next }) => next(req),
({ req, next }) => next(req),
({ req, next }) => next(req)
)