Skip to main content

Asynchronous AnyPay API wrapper

Project description

AnyPayAPI

PyPI PyPI

A simple, yet powerful library for AnyPay API

Usage

With AnyPayAPI you can easily create and retrieve payment and payout info, get informaition about your account's balance and commissions, etc.

Documentation

Official docs can be found on the API's webpage

Installation

pip install anypay

Requirements

  • Python 3.9+
  • httpx
  • pydantic

Features

  • Asynchronous
  • Exception handling
  • Pydantic return model
  • LightWeight

Basic example

import asyncio

from anypay import AnyPayAPI, AnyPayAPIError


api = AnyPayAPI(
    'api_id', 'api_key', no_check=True # you can disable credentials check
) 


async def main():

    try:

        await api.get_balance()

    except AnyPayAPIError as exc:

        print(exc)

    payments = await api.get_payments(project_id=1) # project_id can be provided in __init__
    print(payments[0].id, payments[0].status)

    bill = await api.create_payment(
        pay_id=1234,
        project_id=1,
        method='qiwi',
        email='test@mail.ru',
        amount=100, 
        currency='RUB', 
        description='Test payment', 
    )
    print(bill.id, bill.url)

    bill = await api.create_bill( # easier way to create payment via SCI
        pay_id=1234,
        amount=100,
        project_id=1,
        project_secret='abcd',
    )
    print(bill.id, bill.url)

    #get balance via property (sync)
    print(api.balance)


asyncio.run(main())

Developed by Nikita Minaev (c) 2023

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anypay-1.0.4.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anypay-1.0.4-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file anypay-1.0.4.tar.gz.

File metadata

  • Download URL: anypay-1.0.4.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for anypay-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2c11e225a2b615353bd8fd19bb0d66c058950c687f590b65e2bdab9d2f42d62f
MD5 45643a0b4f2261b144a323e4a3625f7c
BLAKE2b-256 041ae86953aba288c4590d4c148fa22ee94efde7749b82fe1c61ddb6b9cc4e7b

See more details on using hashes here.

File details

Details for the file anypay-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: anypay-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for anypay-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c583303c2c8500327811d01f30372a0f171555f28e2be671621f6d064af4ba24
MD5 f212d6508044564a04d9f569102f2f09
BLAKE2b-256 dcee8b20db1d2f83a0df8dcbca12dc1177aa6b7bb5ae6faf6907645a47ca0416

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page