/LavaBusiness

Asynchronous client for Lava.ru Business-API

Primary LanguagePythonMozilla Public License 2.0MPL-2.0

LavaBusiness

PyPi Package Version PyPi status Supported python versions License Downloads Issues Documentation

LavaBusiness is an asynchronous client for Lava.ru Business-API

LavaBusiness это асинхронный клиент для работы с Lava.ru Бизнес-API

Examples

📕 Basic usage examples

Создание счета

import asyncio
from LavaBusiness import AioLava

SECRET_KEY = ""
PROJECT_ID = ""

api = AioLava(SECRET_KEY, PROJECT_ID)

async def main():
    invoice = await api.create_invoice(100)
    print(f'Pay url: {invoice.url}')
    print(f'Invoice_id: {invoice.invoice_id}')

asyncio.run(main())

Проверка статуса счета

import asyncio
from LavaBusiness import AioLava

SECRET_KEY = ""
PROJECT_ID = ""

api = AioLava(SECRET_KEY, PROJECT_ID)

async def main():
    INVOICE_ID = ""
    status = await api.invoice_status(INVOICE_ID)

    if status == 'success':
        print('Счет оплачен')
    elif status == 'expired':
        print('Счет просрочен')
    else:
        print('Счет ожидает оплаты')
    
asyncio.run(main())

Больше примеров можно найти в директории examples/

Подробная документация расположена на сайте - https://lavabusiness.readthedocs.io/en/latest/

✔ TODO

  • EN Translation
  • httpx -> aiohttp
  • Docs for types.errors

☕ Buy me a coffee

BTC - bc1qmt354lzp06dkmmtx2f7m3xlg6uuu20jt755ce7

USDT ERC-20 - 0x010847D5A10c56B76b4c7baE83ca27d39d30493a