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

qiwi-sdk

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qiwi-sdk

Typed, Promise based, QIWI API (P2P & Personal) client

  • 1.6.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by58.31%
Maintainers
2
Weekly downloads
 
Created
Source

🥝 NodeJS QIWI SDK

license MIT npm GitHub last commit

QIWI SDK

🇬🇧 For english speakers

This document is primarily on Russian, because QIWI Bank (JSC) is Russian bank and mostly russian people interested in this package. Whoever, i added short translations, marked by 🇬🇧 emoji, so you can understand what is going on there.

📕 Содержание / ToC

🇬🇧: Table of Contents

🍬 Почему именно эта библиотека?

🇬🇧: Why use this lib?

  1. Полная поддержка TypeScript
  2. Полностью покрывает Personal и P2P секции QIWI API
  3. Документация прямо в коде, которую отлично подхватывают VSCode и WebStorm

🇬🇧: First-class TS support, Personal & P2P api coverage, In-Code docs that's appear in editor

📦 Установка / Installation

NPM:

npm i -S qiwi-sdk

Yarn:

yarn add qiwi-sdk

✏️ Примеры / Examples

🌐 Перевод через СБП [NEW]

Смотрите подробнее в docs/SRP.md

🔎 Получение информации о владельце кошелька

🇬🇧: Getting information about the owner of the wallet

const QIWI = require("qiwi-sdk");

const qp = new QIWI.Personal(process.env.QIWI_TOKEN);

qp.getPersonProfile().then(console.log);

// => { contractInfo: {...}, authInfo: {...}, userInfo: {...} }

🔑 Создание пары ключей для взаимодействия с P2P

🇬🇧: Creating key pair for P2P API

const QIWI = require("qiwi-sdk");

const qp = new QIWI.Personal(process.env.QIWI_TOKEN);

async function main() {
  const profile = await qp.getPersonProfile();
  const wallet = profile.authInfo.personId;

  const [pk, sk] = await qp.createP2PKeyPair("My super pair name");

  // Да, они инвертированы в порядке,
  // так как PublicKey не всегда нужен
  const p2pc = new QIWI.P2P(sk, pk);

  const bill = await p2pc.createBill({
    amount: {
      value: 1000,
      currency: QIWI.P2P.Currency.RUB
    },
    expirationDateTime: QIWI.P2P.formatLifetime(2 /* 2 дня */),
    comment: "Создание сайта"
  });

  console.log(bill.payUrl);
}

main();

🧱 Получение Лимитов (на TypeScript)

🇬🇧: Getting wallet's limits (on TypeScript)

import { Personal } from "qiwi-sdk";

const qp = new Personal(process.env.QIWI_TOKEN);

async function main() {
  const { limits } = await qp.getLimits(process.env.QIWI_WALLET as string, [
    Personal.LimitType.TURNOVER
  ]);

  const [limit] = limits.RU;

  console.log(limit);
  // => { type: "TURNOVER", currency: "RUB", max: 400000, spent: 0, rest: 400000, ... }
}

Интересует приём и отправка P2P платежей по РФ на NodeJS?

У нас есть точно такое-же типизированное SDK для YooMoney 👉 github.com/AlexXanderGrib/yoomoney-sdk

🇬🇧: Have interest in well-done SDK for YooMoney (formerly Yandex.Money)? Check out my other lib

Keywords

FAQs

Package last updated on 24 Apr 2021

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