跳到內容

Function: parseConfirmQuery() ​

ts
function parseConfirmQuery(source): ConfirmQuery;

Defined in: src/helpers/confirm-query.ts:124

Read the parameters LINE Pay appends to the confirmUrl. The transactionId comes from the user's browser, so anyone can put anything there: it has to be a single string of 1 to 19 digits, and nothing else is let through.

Find the order in your own database by the transactionId that you stored when you called request for it, and take the amount and the currency from that order, never from the URL. Do not find the order by the orderId of the URL and then confirm the transactionId of the URL: the browser can pair any orderId with any transactionId, so a cheap order could be paid with the approval of somebody else's payment. If you do look the order up by orderId, check that order.transactionId === transactionId before you go on.

Parameters ​

source ​

ConfirmQuerySource

Returns ​

ConfirmQuery

Example ​

ts
const { transactionId } = parseConfirmQuery(req.query)
const order = await orders.findByTransactionId(transactionId) // none: answer 404

Throws ​

when a parameter is missing or malformed.

Released under the MIT License. An independent library, not made or endorsed by LINE Pay.