Giter Club home page Giter Club logo

paypay.js's Introduction

PayPay.js

npm node version keywords

Unofficial PayPay client

Features

  • Login
  • Get balance
  • Get History
  • Accept Link
  • Create Link
  • Send Money
  • Get Account Info

How to Use

Login

// CommonJS
const { PayPay, PayPayLoginStatus } = require("paypay.js");
const { createInterface } = require("readline");

// ESM or TypeScript
import { PayPay, PayPayLoginStatus } from "paypay.js";
import { createInterface } from "readline";

const rl = createInterface({
  input: process.stdin,
  output: process.stdout
})

const paypay = new PayPay();
const loginResult = await paypay.login("09012345678", "password");

if (loginResult.status === PayPayLoginStatus.DONE) {
  console.log("Logged in!");
  console.log(`Your access Token: ${loginResult.accessToken}`);
} else if (loginResult.status === PayPayLoginStatus.OTP_REQUIRED) {
  console.log("OTP Required");
  rl.question(`Enter otp code: ${loginResult.otpPrefix}-`, async (answer) => {
    const otpResult = await paypay.loginOtp(loginResult.otpReferenceId, answer);
    console.log("Logged in!");
    console.log(`Your access Token: ${otpResult.accessToken}`);
  })
}

Another feature

const paypay = new PayPay({ accessToken: "YOUR_ACCESS_TOKEN" });
console.log(await paypay.getBalance()); // get balance
console.log(await paypay.getHistory()); // get history
console.log(await paypay.getLinkInfo("L1nKc0dE")); // get send money link info
console.log(await paypay.acceptLink("L1nKc0dE")); // accept link
console.log(await paypay.executeLink(100)); // create 100 yen link

paypay.js's People

Contributors

waki285 avatar

Stargazers

 avatar  avatar  avatar  avatar

paypay.js's Issues

[AxiosError: Request failed with status code 504]

エラー
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "AxiosError: Request failed with status code 504".] {
code: 'ERR_UNHANDLED_REJECTION'
}

コード
const { PayPay } = require("paypay.js");
const paypay = new PayPay();
paypay.login(phone, pass).catch(e => console.error(e));

PayPay.js: 1.1.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.