Skip to main content

Retrieve payment details

If you need to display a customer's payment or refund details or retrieve a specific payment details, you 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 Online API, see Prepare API credentials. The code example described on this page uses the requestOnlineAPI() function defined in the Prepare API credentials code example.

const getPaymentInfo = async function ({ orderIds = [], transactionIds = [] }) {
if (orderIds.length === 0 && transactionIds.length === 0) {
throw new Error(
"At least one of order ID or transaction ID must be input."
);
} else {
const orderIdsQuery = new URLSearchParams(
orderIds.map((value) => ["orderId", value])
);
const transactionIdsQuery = new URLSearchParams(
transactionIds.map((value) => ["transactionId", value])
);

let response = await requestOnlineAPI({
method: "GET",
baseUrl: targetAPIServer,
apiPath: `/v3/payments/${requestTransactionId}/confirm`,
queryString: `${orderIdsQuery.toString()}&${transactionIdsQuery.toString()}`,
});

return response;
}
};

// ...

try {
let response = getPaymentInfo({
orerIds: ["20230601ORD45678910", "20230601ORD45678911"],
});

console.log("Response: ", response);
} catch (error) {
console.log(error);
}

You can add one or more of the same query parameters to set one or more order IDs and transaction IDs, and you can retrieve details for up to 100 payments per API call.

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 varies according to the payment details you retrieve. The following is an example of the payment details received as a response.

{
"returnCode": "0000",
"returnMessage": "success",
"info": [
{
"transactionId": 2019060112345678910,
"transactionDate": "2019-06-01T09:00:00Z",
"transactionType": "PAYMENT",
"payInfo": [
{ "method": "BALANCE", "amount": 110 }
],
"productName": "test production",
"currency": "TWD",
"orderId": "20190601ORD45678910",
// ...
"packages": [
{
"id": "1",
"amount": 85,
"userFeeAmount": 0
},
{
"id": "3",
"amount": 5,
"userFeeAmount": 0
}
]
// ...
}
]
}

If you check payment details with a refund history, the refund information (info.refundList) is included as follows.

{
"returnCode": "0000",
"returnMessage": "success",
"info": [
{
// ...
"refundList": [
{
"refundTransactionId": 2019060112345678911,
"transactionType": "PARTIAL_REFUND",
"refundAmount": -1,
"refundTransactionDate": "2019-06-06T09:00:00Z"
}
// ...
]
// ...
}
]
}

If you retrieve payment details using the response received after refund or the refund transaction ID (info.refundList.refundTransactionId) obtained by retrieving the payment details as above, you can see the refund details as shown below.

{
"returnCode": "0000",
"returnMessage": "success",
"info": [
{
"transactionId": 2019060112345678912,
"transactionDate": "2019-06-01T09:48:43Z",
"transactionType": "PARTIAL_REFUND",
"payInfo": [
{
"method": "CREDIT_CARD",
"amount": 85
},
{
"method": "POINT",
"amount": 8
}
],
"productName": "Brown",
"currency": "TWD",
"orderId": "20190101123123123",
"originalTransactionId": 2019060112345678910
}
]
}