Skip to main content

AAIO

A Library for easy work with Aaio API, in the Python programming language.
Библиотека для легкой работы с Aaio API, на языке программирования Python.

What is available in this library? - Что имеется в данной библиотеке?

  • Creating a bill for payment - Создание счета для оплаты
  • Quick check of payment status - Быстрая проверка статуса оплаты
  • Asynchronous / synchronous version - Асинхронная / синхронная версия
  • Get balance - Получение баланса
  • Get payment info - Получение информации о платежах

Installation - Установка

Required version Python: not lower than 3.7
Требуемая версия Python: не ниже 3.7

pip install AaioAPI

Using - Использование

To get started, you need to register and get all the necessary store data via this link on the official AAIO website
Чтобы начать работу, вам необходимо зарегистрироваться и получить все необходимые данные магазина по этой ссылке на оф.сайте AAIO

Get balance - Получение баланса

Чтобы получить доступ к балансу, скопируйте ваш API Ключ

Использование в синхронной версии:

from AaioAPI import AaioAPI

client = AaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')
balance = client.get_balance()
balance = balance['balance']
# balance = {
#     "type": "success",
#     "balance": 50.43, // Текущий доступный баланс
#     "referral": 0, // Текущий реферальный баланс
#     "hold": 1.57 // Текущий замороженный баланс
#  }

print(balance)

Использование в асинхронной версии:

from AaioAPI import AsyncAaioAPI
import asyncio

async def main():
    client = AsyncAaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')
    balance = await client.get_balance()
    balance = balance['balance']
    # balance = {
    #     "type": "success",
    #     "balance": 50.43, // Текущий доступный баланс
    #     "referral": 0, // Текущий реферальный баланс
    #     "hold": 1.57 // Текущий замороженный баланс
    #  }

    print(balance)


asyncio.run(main())

Get payment info - Получение информации о платеже

Здесь пример получения информации о платеже

Использование в синхронной версии:

from AaioAPI import AaioAPI

client = AaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')
order_id = 'my_id123' # Номер заказа
payment_info = client.get_payment_info(order_id)

print(payment_info)

Использование в синхронной версии:

from AaioAPI import AsyncAaioAPI
import asyncio

async def main():
    client = AsyncAaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')
    order_id = 'my_id123' # Номер заказа
    payment_info = await client.get_payment_info(order_id)

    print(payment_info)


asyncio.run(main())

Здесь вам понадобятся данные вашего магазина

Использование в синхронной версии:

from AaioAPI import AaioAPI
import time

client = AaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')

order_id = 'my_id123' # Номер заказа
amount = 25 # Сумма к оплате
lang = 'ru' # Язык страницы
currency = 'RUB' # Валюта заказа
desc = 'Test payment.' # Описание заказа

URL = client.create_payment(order_id, amount, lang, currency, desc)

print(URL) # Ссылка на оплату

Использование в aсинхронной версии:

from AaioAPI import AsyncAaioAPI
import asyncio

async def main():
    client = AsyncAaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')

    order_id = 'my_id123' # Номер заказа
    amount = 25 # Сумма к оплате
    lang = 'ru' # Язык страницы
    currency = 'RUB' # Валюта заказа
    desc = 'Test payment.' # Описание заказа

    URL = await client.create_payment(order_id, amount, lang, currency, desc)

    print(URL) # Ссылка на оплату


asyncio.run(main())

Example of a status check - Пример проверки статуса

Проверяем статус платежа каждые 5 секунд с помощью цикла

Использование в синхронной версии:

while True:

    if client.is_expired(order_id):                # Если счет просрочен
        print("Invoice was expired")
        break
    elif client.is_success(order_id):              # Если оплата прошла успешно
        print("Payment was succesful")
        break
    else:                                   # Или если счет ожидает оплаты
        print("Invoice wasn't paid. Please pay the bill")
    time.sleep(5)

Использование в асинхронной версии:

while True:

    if await client.is_expired(order_id):                # Если счет просрочен
        print("Invoice was expired")
        break
    elif await client.is_success(order_id):              # Если оплата прошла успешно
        print("Payment was succesful")
        break
    else:                                                # Или если счет ожидает оплаты
        print("Invoice wasn't paid. Please pay the bill")
    await asyncio.sleep(5)

Full Code - Полный код

Синхронная версия:

from AaioAPI import AaioAPI
import time

client = AaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')

order_id = 'my_id123' # Номер заказа
amount = 25 # Сумма к оплате
lang = 'ru' # Язык страницы
currency = 'RUB' # Валюта заказа
desc = 'Test payment.' # Описание заказа

URL = client.create_payment(order_id, amount, lang, currency, desc)

print(URL) # Ссылка на оплату


while True:

    if client.is_expired(order_id):                # Если счет просрочен
        print("Invoice was expired")
        break
    elif client.is_success(order_id):              # Если оплата прошла успешно
        print("Payment was succesful")
        break
    else:                                          # Или если счет ожидает оплаты
        print("Invoice wasn't paid. Please pay the bill")
    time.sleep(5)

Асинхронная версия:

from AaioAPI import AsyncAaioAPI
import asyncio


async def main():
    client = AsyncAaioAPI('API KEY', 'SECRET №1', 'MERCHANT ID')

    order_id = 'my_id123' # Номер заказа
    amount = 25 # Сумма к оплате
    lang = 'ru' # Язык страницы
    currency = 'RUB' # Валюта заказа
    desc = 'Test payment.' # Описание заказа

    URL = await client.create_payment(order_id, amount, lang, currency, desc)

    print(URL) # Ссылка на оплату


    while True:

        if await client.is_expired(order_id):                # Если счет просрочен
            print("Invoice was expired")
            break
        elif await client.is_success(order_id):              # Если оплата прошла успешно
            print("Payment was succesful")
            break
        else:                                                # Или если счет ожидает оплаты
            print("Invoice wasn't paid. Please pay the bill")
        await asyncio.sleep(5)


asyncio.run(main())

License

MIT

Metadata

Release files for AaioAPI 2.5.6

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

Source distribution (sdist)

Source distribution for AaioAPI 2.5.6
File Size Uploaded Provenance Actions
AaioAPI-2.5.6.tar.gz 6.0 kB Without provenance Details for AaioAPI-2.5.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for AaioAPI 2.5.6
File Interpreter ABI Platform Actions
AaioAPI-2.5.6-py3-none-any.whl Python 3 none any Details for AaioAPI-2.5.6-py3-none-any.whl

Total release size: 13.5 kB

Release files / AaioAPI-2.5.6.tar.gz

Download URL AaioAPI-2.5.6.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d9bfed043282661bc73de0e834eac9a8653ba1070b95c7c7acfe2deaddc41604
BLAKE2b-256 checksum
How to use checksums
2bf92a538e2fc3932e28b114c219c5c2406e0db5d7627327ae803a5b114eebc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / AaioAPI-2.5.6-py3-none-any.whl

Download URL AaioAPI-2.5.6-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
893e3e61aa465bf58f8a46180a7404647a9d6303903ed375ac261b73e4aecb19
BLAKE2b-256 checksum
How to use checksums
a30502e19f890451df960500e3bddd0bd4d49bfb4693e9ccd2a789514d4abe97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for AaioAPI 2.5.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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