Skip to main content

Asyncio client for PayOk API

Project description

asyncio_payok

Quickstart

Here's a quick example of using asyncio_payok to get your current balance:

import asyncio
from asyncio_payok import PayOk

async def main():
    client = PayOk('your_api_id', 'your_api_key', 'your_secret_key', 'your_shop_id')
    balance = await client.get_balance()
    print(balance)

asyncio.run(main())

Features

  • Asynchronous requests
  • Easy to use with Python's asyncio
  • Support for payment creation, balance checks, transaction retrieval, and payouts

Usage

Initializing the Client

Create an instance of the PayOk client with your API credentials:

from asyncio_payok import PayOk

client = PayOk(api_id='your_api_id', api_key='your_api_key', secret_key='your_secret_key', shop='your_shop_id')

Get Balance

Retrieve your current balance as follows:

balance = await client.get_balance()

Create Payment

Initiate a payment with the required details:

payment = await client.create_payment(amount='10.00', currency='USD', description='Payment Description', ...)

Transaction History

Fetch the transaction history by payment ID or offset:

transactions = await client.get_transactions(payment_id='123', offset=10)

Create Payout

Send a payout to a specified recipient:

payout = await client.create_payout(amount='10.00', receiver='receiver_info', ...)

Handling Exceptions

Handle API and network exceptions gracefully:

try:
    balance = await client.get_balance()
except Exception as e:
    print(f'Error occurred: {e}')

Dependencies

  • Python 3.6 or higher
  • aiohttp

Contributing

Contributions are welcome! Please open a pull request or issue to propose changes or additions.

License

This project is licensed under the MIT License.

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

asyncio_payok-1.0.0.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

asyncio_payok-1.0.0-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

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