Metadata-Version: 2.4
Name: oxapay
Version: 0.3.0
Summary: A fully-typed asynchronous Python client for interacting with the OxaPay cryptocurrency payment gateway.
Project-URL: Homepage, https://codeberg.org/TheKaram/PyOxapay
Project-URL: Bug Tracker, https://codeberg.org/TheKaram/PyOxapay/issues
Project-URL: Documentation, https://codeberg.org/TheKaram/PyOxapay
Project-URL: Source Code, https://codeberg.org/TheKaram/PyOxapay
Author-email: Karam <karam.47w6v@aleeas.com>
License: MIT License
        
        Copyright (c) 2025 TheKaram
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: bitcoin,blockchain,crypto,cryptocurrency,oxapay,payment
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.11.13
Requires-Dist: pydantic>=2.10.6
Provides-Extra: dev
Requires-Dist: ipython>=8.34.0; extra == 'dev'
Provides-Extra: webhook
Requires-Dist: fastapi>=0.115.11; extra == 'webhook'
Requires-Dist: uvicorn[standard]>=0.34.0; extra == 'webhook'
Description-Content-Type: text/markdown

# OxaPay Python Client

[![PyPI version](https://badge.fury.io/py/oxapay.svg)](https://badge.fury.io/py/oxapay)
[![Python Version](https://img.shields.io/pypi/v/oxapay)](https://pypi.org/project/oxapay/)
[![License](https://img.shields.io/pypi/l/oxapay)](https://codeberg.org/TheKaram/PyOxapay/src/branch/main/LICENSE)

A fully-typed Python client for the [OxaPay](https://oxapay.com/) cryptocurrency payment gateway v1 API.

## Features

- 🚀 Async-first with sync wrapper
- 🔒 Full type hints & Pydantic models
- 🌐 Complete API coverage (Merchant, Payout, Swap, System)
- 🔄 FastAPI webhook integration

## Installation

```bash
pip install oxapay
```

For webhook handling:
```bash
pip install "oxapay[webhook]"
```

## Quick Start

### Create an Invoice

```python
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

```python
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

```python
from fastapi import FastAPI
from oxapay.webhook import WebhookRouter, PaymentWebhookEvent

app = FastAPI()
webhook = WebhookRouter(
    app=app,
    merchant_api_key="your_key",
    path="/webhook"
)

@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.
