Python система быстрых платежей

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.

YooMoney API Python library

License

AlekseyKorshuk/yoomoney-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.rst

API Yoomoney — unofficial python library

This is an unofficial YooMoney API python library.

This repository is based on the official documentation of YooMoney.

  • Access token — Getting an access token
  • Account information — Getting information about the status of the user account.
  • Operation history — This method allows viewing the full or partial history of operations in page mode. History records are displayed in reverse chronological order (from most recent to oldest).
  • Operation details — Provides detailed information about a particular operation from the history.
  • Quickpay forms — The YooMoney form is a set of fields with information about a transfer. You can embed payment form into your interface (for instance, a website or blog). When the sender pushes the button, the details from the form are sent to YooMoney and an order for a transfer to your wallet is initiated.
pip install yoomoney --upgrade

You can install from source with:

git clone https://github.com/AlekseyKorshuk/yoomoney-api --recursive cd yoomoney-api python setup.py install

First of all we need to receive an access token.

  1. Log in to your YooMoney wallet with your username. If you do not have a wallet, create it.
  2. Go to the App registration page.
  3. Set the application parameters. Save CLIENT_ID and YOUR_REDIRECT_URI for net steps
  4. Click the Confirm button.
  5. Paste CLIENT_ID and REDIRECT_URI insted of YOUR_CLIENT_ID and YOUR_REDIRECT_URI. Choose scopes and run code.
  6. Follow all steps from the program.
from yoomoney import Authorize Authorize( client_id="YOUR_CLIENT_ID", redirect_uri="YOUR_REDIRECT_URI", scope=["account-info", "operation-history", "operation-details", "incoming-transfers", "payment-p2p", "payment-shop", ] )

You are done with the most difficult part!

Paste YOUR_TOKEN and run this code:

from yoomoney import Client token = "YOUR_TOKEN" client = Client(token) user = client.account_info() print("Account number:", user.account) print("Account balance:", user.balance) print("Account currency code in ISO 4217 format:", user.currency) print("Account status:", user.account_status) print("Account type:", user.account_type) print("Extended balance information:") for pair in vars(user.balance_details): print("\t-->", pair, ":", vars(user.balance_details).get(pair)) print("Information about linked bank cards:") cards = user.cards_linked if len(cards) != 0: for card in cards: print(card.pan_fragment, " - ", card.type) else: print("No card is linked to the account")
Account number: 410019014512803 Account balance: 999999999999.99 Account currency code in ISO 4217 format: 643 Account status: identified Account type: personal Extended balance information: --> total : 999999999999.99 --> available : 999999999999.99 --> deposition_pending : None --> blocked : None --> debt : None --> hold : None Information about linked bank cards: No card is linked to the account

Paste YOUR_TOKEN and run this code:

from yoomoney import Client token = "YOUR_TOKEN" client = Client(token) history = client.operation_history() print("List of operations:") print("Next page starts with: ", history.next_record) for operation in history.operations: print() print("Operation:",operation.operation_id) print("\tStatus -->", operation.status) print("\tDatetime -->", operation.datetime) print("\tTitle -->", operation.title) print("\tPattern id -->", operation.pattern_id) print("\tDirection -->", operation.direction) print("\tAmount -->", operation.amount) print("\tLabel -->", operation.label) print("\tType -->", operation.type)
List of operations: Next page starts with: None Operation: 670278348725002105 Status --> success Datetime --> 2021-10-10 10:10:10 Title --> Пополнение с карты ****4487 Pattern id --> None Direction -- > in Amount --> 100500.0 Label --> 3784030974 Type --> deposition Operation: 670244335488002313 Status --> success Datetime --> 2021-10-10 10:10:10 Title --> Перевод от 410019014512803 Pattern id --> p2p Direction -- > in Amount --> 100500.0 Label --> 7920963969 Type --> incoming-transfer

Paste YOUR_TOKEN with an OPERATION_ID (example: 670244335488002312) from previous example output and run this code:

from yoomoney import Client token = "YOUR_TOKEN" client = Client(token) details = client.operation_details(operation_id="OPERATION_ID") properties = [i for i in details.__dict__.keys() if i[:1] != '_'] max_size = len(max(properties, key=len)) for prop in properties: print(prop, " " * (max_size - len(prop)), "-->", str(details.__getattribute__(prop)).replace('\n', ' '))
operation_id --> 670244335488002312 status --> success pattern_id --> p2p direction -- > in amount --> 100500.0 amount_due --> None fee --> None datetime --> 2021-10-10 10:10:10 title --> Перевод от 410019014512803 sender --> 410019014512803 recipient --> None recipient_type --> None message --> Justtext comment --> None codepro --> False protection_code --> None expires --> None answer_datetime --> None label --> 7920963969 details --> Justtext type --> incoming-transfer digital_goods --> None
from yoomoney import Quickpay quickpay = Quickpay( receiver="410019014512803", quickpay_form="shop", targets="Sponsor this project", paymentType="SB", sum=150, ) print(quickpay.base_url) print(quickpay.redirected_url)
https://yoomoney.ru/quickpay/confirm.xml?receiver=410019014512803&quickpay-form=shop&targets=Sponsor%20this%20project&paymentType=SB&sum=150 https://yoomoney.ru/transfer/quickpay?requestId=343532353937313933395f66326561316639656131626539326632616434376662373665613831373636393537613336383639

About

YooMoney API Python library

Источник

SberQR 1.0.3

Асинхронная библиотека для работы с SberPay QR/Плати QR.

Ссылки проекта

Статистика

Метаданные

Лицензия: MIT License (MIT)

Требует: Python >=3.7

Сопровождающие

Классификаторы

Описание проекта

Асинхронная библиотека для работы с SberPay QR/Плати QR.

Асинхронная библиотека для работы с SberPay QR/Плати QR.

Позволяет создавать динамический QR и проверять статус платежа.

Если при инициализации класса AsyncSberQR переданы одинаковые tid и id_qr , то будет создан платеж через СБП, иначе через ПлатиQR.

Пример (async)

             Для работы потребуется получить от банка следующие параметры

Распаковка pkcs12 с помощью OpenSSL

Инструкция от ssl.com — для Windows обратите внимание на Cygwin в инструкции

Откройте командную строку, перейдите в папку, где лежит архив сертификата с расширением .p12. Выполните команду: openssl pkcs12 -in .p12 -nodes -nocerts -out private.key Появится запрос пароля. Введите пароль, который вы вводили при создании приложения, нажмите Enter. Далее аналогично выполните команду: openssl pkcs12 -in .p12 -clcerts -nokeys -out client_cert.crt В итоге вы получите приватный ключ в файле private.key и клиентский сертификат в файле client_cert.crt в папке, где лежит архив сертификата. 

Источник

Читайте также:  Скрытое поле
Оцените статью