Qiwi api python github

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

adilkhash/qiwi

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Читайте также:  Запуск приложения python linux

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Python client for Qiwi Payments API (Qiwi Kassa, Qiwi Wallet)

from decimal import Decimal from qiwi_payments.kassa import QiwiKassa kassa = QiwiKassa('MY_SECRET_QIWI_KEY') invoice = kassa.create_bill( amount=Decimal('10.00'), currency='RUB', comment='Pay me ASAP' ) print(invoice.pay_url)

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Простая библиотека позволяющая принимать QIWI платежи.

License

Emberium/SimpleQIWI

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

SimpleQIWI: QIWI API for Humans

Эта библеотека позволит вам производить транзакции и принимать платежи без регистрации магазина.

from SimpleQIWI import * token = "ВАШ ТОКЕН" # https://qiwi.com/api phone = "ВАШ ТЕЛЕФОН" api = QApi(token=token, phone=phone) print(api.balance) # Используйте api.full_balance чтобы получить больше информации о кошельках. 

Переводим деньги на счета QIWI

from SimpleQIWI import * token = "ВАШ ТОКЕН" # https://qiwi.com/api phone = "ВАШ ТЕЛЕФОН" api = QApi(token=token, phone=phone) print(api.balance) api.pay(account="ТЕЛЕФОН ПОЛУЧАТЕЛЯ", amount=1, comment='Привет мир!') print(api.balance)

Получаем входящие платежи

from SimpleQIWI import * token = "ВАШ ТОКЕН" # https://qiwi.com/api phone = "ВАШ ТЕЛЕФОН" api = QApi(token=token, phone=phone) print(api.payments)
from SimpleQIWI import * from time import sleep token = "ВАШ ТОКЕН" # https://qiwi.com/api phone = "ВАШ ТЕЛЕФОН" api = QApi(token=token, phone=phone) price = 1 # Минимальное значение при котором счет будет считаться закрытым comment = api.bill(price) # Создаем счет. Комментарий с которым должен быть платеж генерируется автоматически, но его можно задать # параметром comment. Валютой по умолчанию считаются рубли, но ее можно изменить параметром currency print("Переведите %i рублей на счет %s с комментарием '%s'" % (price, phone, comment)) api.start() # Начинаем прием платежей while True: if api.check(comment): # Проверяем статус print("Платёж получен!") break sleep(1) api.stop() # Останавливаем прием платежей
from SimpleQIWI import * from time import sleep token = "ВАШ ТОКЕН" # https://qiwi.com/api phone = "ВАШ ТЕЛЕФОН" api = QApi(token=token, phone=phone) price = 1 comment = api.bill(price) print("Pay %i rub for %s with comment '%s'" % (price, phone, comment)) @api.bind_echo() # Создаем эхо-функцию. Она будет вызываться при каждом новом полученном платеже. В качестве аргументов ей # передаётся информация о платеже. def foo(bar): print("New payment!") print(bar) api.stop() api.start()

About

Простая библиотека позволяющая принимать QIWI платежи.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

mostm/pyqiwi

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.rst

  • Оплата любых услуг
  • Переводы на любой Qiwi Кошелек
  • Статистика по платежам
  • История о сделанных платежах в любой промежуток времени
  • Прохождение упрощенной идентификации
  • Определение провайдера мобильного телефона
  • Получение текущего курса валют
import pyqiwi wallet = pyqiwi.Wallet(token='', number='79001234567')
payment = wallet.send(pid=99, recipient='79001234567', amount=1.11, comment='Привет!') example = 'Payment is \nRecipient: \nPayment Sum: '.format( payment.transaction['state']['code'], payment.fields['account'], payment.sum) print(example)

Получить комиссию для платежа

commission = wallet.commission(pid=99, recipient='79001234567', amount=1.11) print(commission.qw_commission.amount)

Для более подробных инструкций, посетите документацию.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Simple Python SDK for p2p Qiwi API

Urmipie/qiwi-p2p-api

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Простое Python SDK для p2p Qiwi API Параметры функций, кроме lifetime в оплате через форму, идентичны параметрам из официальной документации QIWi p2p, но изменены для соответствия PEP. Так billId переименовано в bill_id, а все параметры с *DateTime переименованы в *_datetime

  1. Скачать этот репозиторий
  2. Распаковать в папке, где находится исполняемый скрипт или в папке с модулями (что-то вроде $PYTHONPATH$\Lib\site-packages )
  3. pip install -r requirements.txt

Блокировка кошелька из-за referer

QIWI требует, чтобы при переходе по ссылке указывался referer. Если вы передаёте ссылки через мессенджеры или соцсети, вероятнее всего, этот параметр будет указан (по крайней мере, оф. приложения VK и Telegram однозначно оставляют его). Подробнее можете почитать тут.

Создание счёта и печать ссылки на него

from qiwip2py import QiwiP2P from datetime import timedelta qiwi_p2p = QiwiP2P(secret_key=SECRET_KEY) bill = qiwi_p2p.create_bill(bill_id='test', amount=1.99, custom_fields='themeCode': THEME_CODE>, expiration_datetime=timedelta(hours=3)) print(bill.pay_url) # и если требуется ссылка на форму, а не создание счёта через API qiwi_p2p = QiwiP2P(public_key=PUBLIC_KEY) bill = qiwi_p2p.create_bill(bill_id='test2', amount=1.99, custom_fields='themeCode': THEME_CODE>, expiration_datetime=timedelta(hours=3), success_url='http://random.cat', return_pay_link=True) print(bill)

Проверка существования счёта

bill = qiwi_p2p.get_bill('test') if bill: print(f'Счёт на bill.amount_value> bill.amount["currency"]> существует') else: print('Счета не существует')

При создании можно не задавать какой-то из ключей, если его использование не планируется, однако, при использовании метода, для которого этот ключ нужен, будет возвращено Assertion Error или AttributeError, если секретный ключ неверен. Во всех случаях, кроме оплаты через форму, используется секретный ключ.

Во все методы можно передать иные именованные аргументы, вроде proxy, и те передадутся в requests.request

Если return_pay_link == False или не указан, то создаст счёт и вернёт то же самое, что и QiwiP2P.get_bill() с созданным bill_id. Иначе вернёт url формы оплаты. В этом случае требуется публичный, а не секретный ключ

Таблица параметров и соответствия с Qiwi p2p

Параметр Через API Через форму Описание
bill_id передаётся в url billId Уникальный идентификатор выставляемого счета в вашей системе
amount amount.value amount Сумма, на которую выставляется счет, округленная в меньшую сторону до 2 десятичных знаков
amount_currency amount.currency недоступно. Только через RUB Валюта суммы счета. Возможные значения: RUB — рубли (по умолчанию), KZT — тенге
phone customer.phone phone Номер телефона пользователя (в международном формате)
email customer.email email E-mail пользователя
account customer.account account Идентификатор пользователя в вашей системе
comment comment comment Комментарий к счету (Виден пользователю при оплате)
expiration_datetime expirationDateTime lifetime datetime.timedelta промежуток, который доступен счёт
custom_fields customFields customFields dict с дополнительными полями (themeCode, paySourcesFilter, свои поля)
success_url недоступно successUrl URL для переадресации в случае успешного перевода
return_pay_link Если True, возвращает строку с ссылкой на форму, вместо создания счёта и возвращения Bill

Все методы, кроме create_bill(return_pay_link=True) возвращают один из этих двух объектов, кроме случаев с неуказанным или неверным секретным ключом:

Атрибут QIWI Тип Описание
site_id siteId str siteId
bill_id billId
amount amount dict Данные о сумме счета
amount_value amount.value float Сумма счета
status status dict Данные о статусе счета
status_value status.value str: ‘WAITING’, ‘PAID’, ‘REJECTED’ или ‘EXPIRED’ Статус счёта
costumer customer dict Идентификаторы пользователя
custom_fields customFields dict строковые данные, переданные вами
comment comment str Комментарий к счёту
creation_datetime creationDateTime datetime.datetime Системная дата создания счета
expiration_datetime expirationDateTime datetime.datetime Срок действия созданной формы для перевода
pay_url payUrl str Ссылка для переадресации пользователя на созданную форму
json dict Преобразованный в dict json из ответа Qiwi

Объект, возвращаемый при коде, отличном от 200

  • status_code: status_code: int — код ошибки
  • json: dict — Преобразованный в dict json из ответа Qiwi
  • service_name
  • error_code
  • description
  • user_message
  • datetime
  • trace_id

Если вы почему-то столкнулись с какими-то проблемами, но почему-то не хотите открыть issues или же просто желаете что-то написать, можете достать меня в telegram или VK

Источник

Оцените статью