# aiocpa
[![Python](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/main/src/badges/python310_313.json)](https://www.python.org/)
[![Crypto Pay API](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/refs/heads/main/src/badges/cryptopayapi.json)](https://help.crypt.bot/crypto-pay-api)
[![Documentation Status](https://readthedocs.org/projects/aiocpa/badge/?version=latest)](https://aiocpa.readthedocs.io/en/latest/?badge=latest)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
[![Aiohttp](https://img.shields.io/badge/aiohttp-v3-2c5bb4?logo=aiohttp)](https://docs.aiohttp.org/en/stable/)
[![Code linter: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)
[![Checked with mypy](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/main/src/badges/mypy.json)](https://mypy-lang.org/)
**aiocpa** is a syncronous & asynchronous [Crypto Pay API](https://help.crypt.bot/crypto-pay-api) client.
> ## [Official documentation](https://aiocpa.readthedocs.io/en/latest/)
## Quick start
```python
import asyncio
from cryptopay import CryptoPay
async def main():
cp = CryptoPay(token="TOKEN")
app = await cp.get_me()
print(app.name) # Your App Name
if __name__ == "__main__":
asyncio.run(main())
```
## aiogram 3.x integration example
```python
import asyncio
from aiogram import Bot, Dispatcher
from cryptopay import CryptoPay
cp = CryptoPay("TOKEN")
bot = Bot("TOKEN")
dp = Dispatcher()
@dp.message()
async def get_invoice(message):
invoice = await cp.create_invoice(1, "USDT")
await message.answer(f"pay: {invoice.bot_invoice_url}")
invoice.await_payment(message=message)
@cp.polling_handler()
async def handle_payment(invoice, message):
await message.answer(f"invoice #{invoice.invoice_id} has been paid")
async def main():
await asyncio.gather(
dp.start_polling(bot),
cp.run_polling(),
)
if __name__ == "__main__":
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/vovchic17/aiocpa",
"name": "aiocpa",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "crypto pay, CryptoBot, Crypto Pay API",
"author": "VoVcHiC",
"author_email": "tsvetkovvova17@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e6/d3/85fb23d8a730713aeba357e59cefc01eb8429bef122cbe932ce29636d036/aiocpa-0.1.14.tar.gz",
"platform": null,
"description": "# aiocpa\n\n[![Python](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/main/src/badges/python310_313.json)](https://www.python.org/)\n[![Crypto Pay API](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/refs/heads/main/src/badges/cryptopayapi.json)](https://help.crypt.bot/crypto-pay-api)\n[![Documentation Status](https://readthedocs.org/projects/aiocpa/badge/?version=latest)](https://aiocpa.readthedocs.io/en/latest/?badge=latest)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)\n[![Aiohttp](https://img.shields.io/badge/aiohttp-v3-2c5bb4?logo=aiohttp)](https://docs.aiohttp.org/en/stable/)\n[![Code linter: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)\n[![Checked with mypy](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/vovchic17/static/main/src/badges/mypy.json)](https://mypy-lang.org/)\n\n**aiocpa** is a syncronous & asynchronous [Crypto Pay API](https://help.crypt.bot/crypto-pay-api) client.\n\n> ## [Official documentation](https://aiocpa.readthedocs.io/en/latest/)\n\n## Quick start\n```python\nimport asyncio\nfrom cryptopay import CryptoPay\n\n\nasync def main():\n cp = CryptoPay(token=\"TOKEN\")\n app = await cp.get_me()\n print(app.name) # Your App Name\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## aiogram 3.x integration example\n\n```python\nimport asyncio\nfrom aiogram import Bot, Dispatcher\nfrom cryptopay import CryptoPay\n\ncp = CryptoPay(\"TOKEN\")\nbot = Bot(\"TOKEN\")\ndp = Dispatcher()\n\n\n@dp.message()\nasync def get_invoice(message):\n invoice = await cp.create_invoice(1, \"USDT\")\n await message.answer(f\"pay: {invoice.bot_invoice_url}\")\n invoice.await_payment(message=message)\n\n\n@cp.polling_handler()\nasync def handle_payment(invoice, message):\n await message.answer(f\"invoice #{invoice.invoice_id} has been paid\")\n\n\nasync def main():\n await asyncio.gather(\n dp.start_polling(bot),\n cp.run_polling(),\n )\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "sync & async Crypto Pay API client.",
"version": "0.1.14",
"project_urls": {
"Documentation": "https://aiocpa.readthedocs.io/en/latest/",
"Homepage": "https://github.com/vovchic17/aiocpa",
"Repository": "https://github.com/vovchic17/aiocpa"
},
"split_keywords": [
"crypto pay",
" cryptobot",
" crypto pay api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2bffeb1b860e36277c13f98672038323c3e2bdf1a47c53bf86f826054792a9ed",
"md5": "80b6521dab8587bcdbb85e21425fd47b",
"sha256": "c43148103e24a16d59896d6db395ed66a2cd5772ff308dfea10aa36b7f433589"
},
"downloads": -1,
"filename": "aiocpa-0.1.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "80b6521dab8587bcdbb85e21425fd47b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 46496,
"upload_time": "2024-11-20T18:50:01",
"upload_time_iso_8601": "2024-11-20T18:50:01.963098Z",
"url": "https://files.pythonhosted.org/packages/2b/ff/eb1b860e36277c13f98672038323c3e2bdf1a47c53bf86f826054792a9ed/aiocpa-0.1.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6d385fb23d8a730713aeba357e59cefc01eb8429bef122cbe932ce29636d036",
"md5": "122848fa0b0c5c3bc545cbbc74d7f99f",
"sha256": "556bfea997880f1365d3822d26ea57e2cfaecb231128ea1e7e50ad1f778147bb"
},
"downloads": -1,
"filename": "aiocpa-0.1.14.tar.gz",
"has_sig": false,
"md5_digest": "122848fa0b0c5c3bc545cbbc74d7f99f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 27354,
"upload_time": "2024-11-20T18:50:03",
"upload_time_iso_8601": "2024-11-20T18:50:03.640485Z",
"url": "https://files.pythonhosted.org/packages/e6/d3/85fb23d8a730713aeba357e59cefc01eb8429bef122cbe932ce29636d036/aiocpa-0.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 18:50:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vovchic17",
"github_project": "aiocpa",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiocpa"
}