1.0.6 • Published 4 years ago

line-pay-v3 v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

line-pay-v3

SDK for LINE Pay API v3

Installation

npm install --save line-pay-v3

Usage

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'
})

API

linePay.request(body)

An API to request payment information to LINE Pay

linePay.confrim(body, transactionId)

  • body (Objcet) : { amount: NUMBER, currency: STRING }
  • transactionId (String)

linePay.capture(body, transactionId)

  • body (Objcet) : { amount: NUMBER, currency: STRING }
  • transactionId (String)

linePay.void(transactionId)

  • transactionId (String)

linePay.refund(body, transactionId)

  • body (Object) : { refundAmount: NUMBER }
  • transactionId (String)

linePay.paymentDetails(params)

all params are optional

linePay.checkPaymentStatus(transactionId)

  • transactionId (String)

linePay.checkRegKey(params, regKey)

  • params (Object) : { creditCardAuth: BOOBLEAN }
  • regKey (String)

linePay.checkRegKey(params, regKey)

  • params (Object) : { creditCardAuth: BOOBLEAN }
  • regKey (String)

linePay.preapprovedPay(body, regKey)

linePay.expireRegKey(regKey)

  • regKey (String)

Example

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'
  }
}

API Documentation

LINE Pay OnliceAPI

GitHub repository

GitHub

Release Note

versioncontents
1.0.6fix transactionId may over 19 digit
1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago