SDK for LINE Pay API v3
npm install --save line-pay-v3
example config for Sandbox environment
set uri to https://api-pay.line.me
for Production
const LinePay = require('line-pay-v3')
let linePay = new LinePay({
channelId: YOUR_CHANNEL_ID,
channelSecret: YOUR_CHANNEL_SECRET,
uri: 'https://sandbox-api-pay.line.me'
})
An API to request payment information to LINE Pay
- body (Object) : order info just checkout API Document
- body (Objcet) : { amount: [NUMBER], currency: [STRING] }
- transactionId (String)
- body (Objcet) : { amount: [NUMBER], currency: [STRING] }
- transactionId (String)
- transactionId (String)
- body (Object) : { refundAmount: [NUMBER] }
- transactionId (String)
all params are optional
- params (Object) : { transactionId: [STRING], orderId: [STRING], fields: [STRING] }
- transactionId (String)
- params (Object) : { creditCardAuth: [BOOBLEAN] }
- regKey (String)
- params (Object) : { creditCardAuth: [BOOBLEAN] }
- regKey (String)
- body (Object) -> { productName: [STRING], amount: [NUMBER], currency: [STRING], orderID: [STRING], capture: [BOOLEAN] }
- regKey (String)
- regKey (String)
A request API example
const order = {
amount: 4000,
currency: 'TWD',
orderId: 'Order2019101500001',
packages: [
{
id: 'Item20191015001',
amount: 4000,
name: 'testPackageName',
products: [
{
name: 'testProductName',
quantity: 2,
price: 2000
}
]
}
],
redirectUrls: {
confirmUrl: 'https://example.com/confirmUrl',
cancelUrl: 'https://example.com/cancelUrl'
}
}
linePay.request(order).then(res => {
console.log(res)
})
// response JSON
{
returnCode: '0000',
returnMessage: 'Success.',
info: {
paymentUrl: {
web: 'https://sandbox-web-pay.line.me/web/payment/wait?transactionReserveId=WDk1N2x2ankzck9JUEJDS3NETmwzV05Zckw0bHE4R25PSWZ5N0xDR25RaRLdE5YMU1yUlpxqQU8wGF4V2llUQx',
app: 'line://pay/payment/WDk1N2x2ankzck9JUEJDS3NETmwzV05Zck0bHE4R25PSWZ5N0xDR25RnRLdE5YMU1xyUlpqQU8waGF4Vx2llUQ'
},
transactionId: 2019101500070266000,
paymentAccessToken: '040316708383'
}
}