Skip to main content

API Yoomoney (async) - unofficial python library

This is an unofficial YooMoney API python library.

This repository was taken as a basis.

Introduction

This repository is based on the official documentation of YooMoney.

Features

Implemented methods:

  • 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.

Installation

You can install with:

pip install aioyoomoney-api

You can install from source with:

git clone https://github.com/paranoik1/aioyoomoney-api
cd aioyoomoney-api
pip install .

Quick start

Access token

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, REDIRECT_URI and CLIENT_SECRET insted of YOUR_CLIENT_ID, YOUR_REDIRECT_URI and YOUR_CLIENT_SECRET. Choose scopes and run code.
  6. Follow all steps from the program.
from aioyoomoney import authorize

token = authorize(
    client_id=CLIENT_ID,
    redirect_uri=REDIRECT_URI,
    client_secret=CLIENT_SECRET,
    scope=[
        "account-info",
        "operation-history",
        "operation-details",
        "incoming-transfers",
        "payment-p2p",
    ]
)

print(token)

You are done with the most difficult part!

Account information

Paste YOUR_TOKEN and run this code:

import asyncio

from aioyoomoney import Client


async def client_info():
    client = Client(YOUR_TOKEN)

    account = await client.account_info()

    print(f"Account: {account.id}")
    print(f"Balance: {account.balance}")
    print(f"Currency: {account.currency}")
    print(f"Account Status: {account.account_status}")
    print(f"Account Type: {account.account_type}")
    print(f"Balance Details: {account.balance_details}")
    print(f"Cards Linked: {account.cards_linked}")


asyncio.run(client_info())

Operation history

Paste YOUR_TOKEN and run this code:

import asyncio

from aioyoomoney import Client
from dataclasses import fields


async def get_operation_history():
    client = Client(YOUR_TOKEN)

    history = await client.operation_history()
    print("Next record:", history.next_record)
    for operation in history.operations:
        for field in fields(operation):
            if field.name != "kwargs":
                print(field.name, '->', operation[field.name])

        for key, value in operation.kwargs.items():
            print(key, '->', value)

        print("================================")


asyncio.run(get_operation_history())

Operation details

Paste YOUR_TOKEN with an OPERATION_ID (example: 670244335488002312):

import asyncio
from aioyoomoney import Client
from dataclasses import fields


async def get_operation_details():
    client = Client(YOUR_TOKEN)

    operation = await client.operation_details(OPERATION_ID)
    for field in fields(operation):
        if field.name != "kwargs":
            print(field.name, '->', operation[field.name])

    for key, value in operation.kwargs.items():
        print(key, '->', value)


asyncio.run(get_operation_details())

Quickpay forms

Run this code:

import asyncio
from aioyoomoney import Quickpay


async def quickpay():
    async with Quickpay(
        receiver="899999999999999",
        quickpay_form="shop",
        targets="Sponsor this project",
        payment_type="SB",
        sum=10,
        form_comment='test',
        label="label"
    ) as quickpay:
        print(quickpay.redirected_url)
        print(quickpay.base_url)
        print(quickpay.payload)


asyncio.run(quickpay())

Metadata

Release files for aioyoomoney-api 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aioyoomoney-api 0.0.10
File Size Uploaded
aioyoomoney_api-0.0.10.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aioyoomoney-api 0.0.10
File Interpreter ABI Platform
aioyoomoney_api-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 26.4 kB

Release files / aioyoomoney_api-0.0.10.tar.gz

Download URL aioyoomoney_api-0.0.10.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8b77f25990575ee5c6527a4add4321acf8eb755dfa84c4c573533100fa9bbf3f
BLAKE2b-256 checksum
How to use checksums
ac92412108b85f46434609822965087f2f4b73f73418ce1dd47e4d75fdbd5dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / aioyoomoney_api-0.0.10-py3-none-any.whl

Download URL aioyoomoney_api-0.0.10-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
708af6b48db29d782859942217f6b2c0b0787286e75e200ee5cdee678ceb1e5b
BLAKE2b-256 checksum
How to use checksums
bb517d84d415e8ede4559b8e35e8c8a6b59a608ff434ab2f86391298c1a64292
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page