A fully-typed asynchronous Python client for interacting with the OxaPay cryptocurrency payment gateway.
Project description
OxaPay Python Client
A fully-typed Python client for the OxaPay cryptocurrency payment gateway v1 API.
Features
- 🚀 Async-first with sync wrapper
- 🔒 Full type hints & Pydantic models
- 🌐 Complete API coverage (Merchant, Payout, Swap, System)
- 🔄 Litestar webhook integration
Installation
pip install oxapay
For webhook handling:
pip install "oxapay[webhook]"
Quick Start
Create an Invoice
import asyncio
from oxapay import OxaPayClient, CreateInvoiceRequest
async def main():
async with OxaPayClient(merchant_api_key="your_key") as client:
invoice = CreateInvoiceRequest(
amount=100,
currency="USD",
order_id="order_123"
)
response = await client.create_invoice(invoice)
print(f"Payment URL: {response.data.payment_url}")
print(f"Track ID: {response.data.track_id}")
asyncio.run(main())
Sync Client
from oxapay.sync import SyncOxaPayClient, CreateInvoiceRequest
client = SyncOxaPayClient(merchant_api_key="your_key")
response = client.create_invoice(
CreateInvoiceRequest(amount=100, currency="USD")
)
print(response.data.payment_url)
Webhooks
from litestar import Litestar
from oxapay.webhook import WebhookRouter, PaymentWebhookEvent
webhook = WebhookRouter(
merchant_api_key="your_key",
path="/webhook"
)
app = Litestar(route_handlers=[webhook.router])
@webhook.on_payment_paid
async def handle_payment(event: PaymentWebhookEvent):
print(f"Payment received: {event.track_id}")
API Coverage
- Merchant: Invoices, white-label, static wallets, payment info
- Payout: Send crypto, track payouts, balances
- Swap: Exchange rates, swap requests
- System: Prices, currencies, networks, status
Examples
See the examples/ directory for more detailed usage patterns.
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
oxapay_litestar-0.3.1.tar.gz
(146.3 kB
view details)
File details
Details for the file oxapay_litestar-0.3.1.tar.gz.
File metadata
- Download URL: oxapay_litestar-0.3.1.tar.gz
- Upload date:
- Size: 146.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547e9fe7e35d349d4ed92a8ad0032fd496c2d737ed825860fb7d3a0f08f9270f
|
|
| MD5 |
9856206c2ed7cae82b08b9b2b96cc976
|
|
| BLAKE2b-256 |
4df467fef447c2632b29dd97c0a6fdb543936a93869b93629cda0e69a9123758
|