npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qiwi_p2p_api-typescript

v0.1.2

Published

QIWI P2P API wrapper via TypeScript

Downloads

1

Readme

Qiwi P2P API

Node.js SDK модуль для внедрения единого платежного протокола эквайринга и QIWI Кошелька.

Установка и подключение

Установка с помощью npm:

$ npm i qiwi_p2p_api-typescript --save

Подключение:

const { QiwiP2P } = require('qiwi_p2p_api-typescript')
const qiwiApi = new QiwiP2P(PUBLIC_KEY, SECRET_KEY)

Документация

Пошаговое руководство по работе с SDK (для физических лиц): https://developer.qiwi.com/ru/p2p-sdk-guide/#integration-sdk API P2P-счетов (для физических лиц): https://developer.qiwi.com/ru/p2p-payments API QIWI Кассы (для юридических лиц): https://developer.qiwi.com/ru/bill-payments

Авторизация

Для использования SDK требуется SECRET_KEY, подробности в документации — для физ.лиц, для юр.лиц.

Выставление счета

Надежный способ для интеграции. Параметры передаются server2server с использованием авторизации. Метод позволяет выставить счет, при успешном выполнении запроса в ответе вернется параметр payUrl - ссылка для редиректа пользователя на платежную форму.

Метод createBill выставляет новый счет. В параметрах нужно указать: идентификатор счета billId внутри вашей системы и дополнительными параметрами fields. В результате будет получен ответ с данными о выставленном счете.

Подробное описание параметров для выставления счёта представлено в руководстве по работе с SDK, а так же в документации для физ.лиц и для юр. лиц

const billId = 'cc961e8d-d4d6-4f02-b737-2297e51fb48e';

const fields = {
    amount: {
        value: 10.00
        currency: 'RUB',
    },
    comment: 'test',
    expirationDateTime: '2018-03-02T08:44:07',
    customer: {
        phone: '79009009090',
        email: '[email protected]',
        account : 'client4563',
    }
};

const bill = await qiwiApi.createBill( billId, fields )

В результате:

{
    "siteId": "270305",
    "billId": "cc961e8d-d4d6-4f02-b737-2297e51fb48e",
    "amount": {
        "currency": "RUB",
        "value": "200.34"
    },
    "status": {
        "value": "WAITING",
        "changedDateTime": "2018-07-12T10:28:38.855+03:00"
    },
    "comment": "test",
    "creationDateTime": "2018-07-12T10:28:38.855+03:00",
    "expirationDateTime": "2018-08-26T10:28:38.855+03:00",
    "payUrl": "https://oplata.qiwi.com/form/?invoice_uid=bb773791-9bd9-42c1-b8fc-3358cd108422&successUrl=http%3A%2F%2Ftest.ru%2F"
}

Информация о счете

Метод getBillInfo возвращает информацию о счете. В параметрах нужно указать идентификатор счета billId внутри вашей системы, в результате будет получен ответ со статусом счета. Подробнее в документации — для физ.лиц, для юр.лиц.

const billId = 'cc961e8d-d4d6-4f02-b737-2297e51fb48e'

const billData = qiwiApi.checkBill(billId)

Ответ:

{
    "siteId": "270305",
    "billId": "cc961e8d-d4d6-4f02-b737-2297e51fb48e",
    "amount": {
        "currency": "RUB",
        "value": "200.34"
    },
    "status": {
        "value": "WAITING",
        "changedDateTime": "2018-07-12T10:31:06.846+03:00"
    },
    "comment": "test",
    "creationDateTime": "2018-07-12T10:31:06.846+03:00",
    "expirationDateTime": "2018-08-26T10:31:06.846+03:00",
    "payUrl": "https://oplata.qiwi.com/form/?invoice_uid=ee3ad91d-cfb8-4dbf-8449-b6859fdfec3c"
}

Отмена неоплаченного счета

Метод cancelBill отменяет неоплаченный счет. В параметрах нужно указать идентификатор счета billId внутри вашей системы, в результате будет получен ответ с информацией о счете. Подробнее в документации — для физ.лиц, для юр.лиц.

const billId = 'cc961e8d-d4d6-4f02-b737-2297e51fb48e'

const canceledBill = qiwiApi.cancelBill(billId)

Ответ:

{
    "siteId": "270305",
    "billId": "cc961e8d-d4d6-4f02-b737-2297e51fb48e",
    "amount": {
        "currency": "RUB",
        "value": "200.34"
    },
    "status": {
        "value": "REJECTED",
        "changedDateTime": "2018-07-12T10:32:17.595+03:00"
    },
    "comment": "test",
    "creationDateTime": "2018-07-12T10:32:17.481+03:00",
    "expirationDateTime": "2018-08-26T10:32:17.481+03:00",
    "payUrl": "https://oplata.qiwi.com/form/?invoice_uid=cc961e8d-d4d6-4f02-b737-2297e51fb48e"
}