Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

line-pay

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

line-pay

SDK to use LINE Pay API in node.js app

  • 1.0.16
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Overview

This is unofficial SDK to use LINE Pay inside the node.js based application on top of express framework.

Getting started

Create sandbox

Go to LINE Pay Developers and create your sandbox. You can retrieve Channel Id and Channel Secret Key after successful login to LINE Pay Console. You also need to configure white lists of server ip addresses which access to LINE Pay API.

Installation

$ npm install --save line-pay

Server/Router configuration

Here is extremely basic server configuration to start payment flow.

"use strict";

const app = require("express")();
const uuid = require("uuid/v4");
const line_pay = require("line-pay");

const pay = new line_pay({
    channelId: process.env.LINE_PAY_CHANNEL_ID,
    channelSecret: process.env.LINE_PAY_CHANNEL_SECRET,
    isSandbox: true
});

app.listen(process.env.PORT || 5000, () => {
    console.log(`server is listening to ${process.env.PORT || 5000}...`);
});

app.use("/pay", pay.middleware({
    productName: "demo product",
    amount: 1,
    currency: "JPY",
    orderId: uuid()
}), (req, res, next) => {
    // Now payment should have been completed.
    res.send("Payment has been completed.");
});

When you open browser and access to https://YOUR_HOSTNAME/pay, it starts payment flow by reserving payment and redirect you to authorization screen.

When you approve the payment, you redirect back to https://YOUR_HOSTNAME/pay/confirm and the server actually captures the payment.

You can control the flow by using individual methods like reserve() or confirm() in the SDK.

Reference

For more methods, refer to API reference. Demo & Sample code to use LINE Pay inside chatbot would be a good reference for Bot developers.

License

MIT

Keywords

FAQs

Package last updated on 16 Aug 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc