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.7+
  • 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', check=False,  # 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.1.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

anypay-1.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for anypay-1.1.1.tar.gz
Algorithm Hash digest
SHA256 850ce10eb7df15e58b8f0cd4d53b8cafdacb4a1fc43f3046a763577b7d936f5a
MD5 997b078a8c733217afa069db55877ea7
BLAKE2b-256 213ded7ccad58b49f8553c9300e85247d28a9d8a31c6ee1f9dfc4c4d2e036f10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anypay-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9744593d5fb27bf12b2479dff7c0db2a2cf8f1354b9b1a854f77cebbed98ceae
MD5 d39a9778c9d953e3be4ca64a50b81c0f
BLAKE2b-256 3c974508d5a1f22ac579636ae6eae24bc6448436c1bc1081b454855d39c1b2c2

See more details on using hashes here.

Supported by

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