Retrieve payment details
If merchants need to see specific payment details, they can use the payment details retrieval API. Request payment details as follows using the order ID issued by the merchant or the transaction ID delivered by the LINE Pay server as a response.
For information on obtaining the credentials needed to call the Offline API, see Prerequisites. The code example described on this page uses the
requestLINEPayAPI()function defined in the Prerequisites code example.
const getPaymentInfo = async function ({ orderId = "", transactionId = "" }) {
let queryString = "";
if (orderId === "" && transactionId === "") {
throw new Error(
"At least one of order ID or transaction ID must be input."
);
} else if (orderId !== "") {
queryString = `orderId=${orderId}`;
} else {
queryString = `transactionId=${transactionId}`;
}
let response = await requestLINEPayAPI({
method: "GET",
baseUrl: targetAPIServer,
apiPath: `/v4/payments?${queryString}`,
queryString: queryString,
});
return response;
};
// ...
try {
let response = getPaymentInfo({ orderId: "test_order_1" });
console.log("Response: ", response);
} catch (error) {
console.log(error);
}
You must enter at least one of order ID or transaction ID in the query parameters.
Depending on the platform, you may need to process the transaction ID as a string when processing transaction ID information. For more information, see the Transaction ID.
The information included in the response may vary according to the retrieved payment details. The following is an example of the payment details received as a response.
{
"returnCode": "0000",
"returnMessage": "success",
"info": [
{
"transactionId": 2019049910005495123,
"transactionDate": "2019-04-05T11:52:20Z",
"transactionType": "PAYMENT",
"productName": "Test product",
"currency": "TWD",
"payInfo": [
{
"method": "BALANCE",
"amount": 100
}
]
}
]
}
If you check payment details with a refund history, the refund information (info.refundList) is included as follows.
{
"returnCode": "0000",
"returnMessage": "success",
"info": [
{
"transactionId": 2019049910005496810,
"transactionDate": "2019-04-08T06:31:19Z",
"transactionType": "PAYMENT",
"productName": "test product",
"currency": "TWD",
"payInfo": [
{
"method": "BALANCE",
"amount": 100
}
],
"refundList": [
{
"refundTransactionId": 2019049910005497012,
"transactionType": "PARTIAL_REFUND",
"refundAmount": 50,
"refundTransactionDate": "2019-04-08T06:33:17Z"
}
],
"orderId": "20190408001"
}
]
}