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())
- Asynchronous requests
- Easy to use with Python's asyncio
- Support for payment creation, balance checks, transaction retrieval, and payouts
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')
Retrieve your current balance as follows:
balance = await client.get_balance()
Initiate a payment with the required details:
payment = await client.create_payment(amount='10.00', currency='USD', description='Payment Description', ...)
Fetch the transaction history by payment ID or offset:
transactions = await client.get_transactions(payment_id='123', offset=10)
Send a payout to a specified recipient:
payout = await client.create_payout(amount='10.00', receiver='receiver_info', ...)
Handle API and network exceptions gracefully:
try:
balance = await client.get_balance()
except Exception as e:
print(f'Error occurred: {e}')
- Python 3.6 or higher
aiohttp
Contributions are welcome! Please open a pull request or issue to propose changes or additions.
This project is licensed under the MIT License.