![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
line-pay-merchant
Advanced tools
npm install --save line-pay-merchant
Request:
import { createLinePayClient } from 'line-pay-merchant'
const linePayClient = createLinePayClient({
channelId: '1479113123',
channelSecretKey: '1f021e50f28fb3f40b7a9c5e758b0a19',
env: 'development'
})
const order = {
amount: 1000,
currency: 'TWD',
orderId: '20211209003',
packages: [
{
id: 'c99abc79-3b29-4f40-8851-bc618ca57856',
amount: 1000,
products: [
{
name: 'Product Name',
quantity: 2,
price: 500
}
]
}
],
redirectUrls: {
confirmUrl: 'https://myshop.com/confirmUrl',
cancelUrl: 'https://myshop.com/cancelUrl'
}
}
const res = await linePayClient.request({
body: order
})
console.log(res)
Response:
{
body: {
returnCode: '0000',
returnMessage: 'Success.',
info: {
paymentUrl: {
web: 'https://sandbox-web-pay.line.me/web/payment/wait?transactionReserveId=MGG5dXZZaatkK3Y0NlFmTVVCdXVpTWtyYlp1SEhVQUwwRnkzRkhTTXBQRjZRV0pkUEFJbGhWdzNiU0M2ZlBFTA',
app: 'line://pay/payment/MGY5dXZZaitkK3Y0NlFmTVVCdXVpTWtzYlp1SEhVQUwwRnkzRkhTTXBQRjZRV0pkUEFJcGhWdzNiU0M2ZlBFTA'
},
transactionId: 2021120900898162200,
paymentAccessToken: '361925937255'
}
},
comments: {}
}
Request:
const res = await linePayClient.refund
.addHandler(async (req, next) => {
console.log('before first handler')
const result = await next(req)
console.log('after first handler')
return result
})
.addHandlers(
async (req, next) => {
console.log('before second handler')
const result = await next(req)
const result2 = await next(req)
console.log('after second handler')
return result
},
async (req, next) => {
console.log('before third handler')
const result = await next(req)
console.log('after third handler')
return result
}
)
.send({
transactionId: '2021120900898162200',
body: {
refundAmount: 20
}
})
Output:
before third handler
before second handler
before first handler
after first handler
before first handler
after first handler
after second handler
after third handler
FAQs
LINE Pay Merchant API V3
The npm package line-pay-merchant receives a total of 138 weekly downloads. As such, line-pay-merchant popularity was classified as not popular.
We found that line-pay-merchant demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.