Metadata-Version: 2.4
Name: paychainly
Version: 1.0.0
Summary: Python SDK for the Paychainly crypto payment platform
Project-URL: Homepage, https://paychainly.com
Project-URL: Repository, https://github.com/paychainly/python-sdk
Project-URL: Issues, https://github.com/paychainly/python-sdk/issues
Author-email: Paychainly <hello@paychainly.com>
License: MIT
Keywords: bnb,crypto,paychainly,payments,sdk,usdt
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# paychainly

Python SDK for the [Paychainly](https://paychainly.com) crypto payment platform.

## Installation

```bash
pip install paychainly
```

Requires Python 3.10+.

## Quick start

```python
from paychainly import Paychainly

client = Paychainly(api_key="pk_live_...")

# Create a payment link
link = client.payment_links.create(
    unique_id="order_123",
    token_symbol="USDT",
    network="BNB",
    amount="49.99",
)
print(link.pay_url)  # https://paychainly.com/pay/pay-abc123

# Generate a deposit address
address = client.addresses.generate(token_symbol="USDT", network="BNB")
print(address.address)  # 0x...

# List recent transactions
result = client.transactions.list(status="confirmed")
for tx in result.data:
    print(tx.tx_hash, tx.amount)
```

## Async usage

```python
import asyncio
from paychainly import AsyncPaychainly

async def main():
    async with AsyncPaychainly(api_key="pk_live_...") as client:
        link = await client.payment_links.create(
            unique_id="order_456",
            token_symbol="USDT",
            network="BNB",
        )
        print(link.pay_url)

asyncio.run(main())
```

## Webhook verification

```python
from paychainly import Webhooks, WebhookSignatureError

# In your Flask / FastAPI / Django webhook handler:
raw_body = request.get_data()          # bytes — must be raw, before JSON parsing
signature = request.headers.get("X-Paychainly-Signature", "")

try:
    event = Webhooks.verify(raw_body, signature, "whsec_...")
    print(event.event, event.amount)   # "deposit_detected", "100.00"
except WebhookSignatureError:
    return "Invalid signature", 400
```

## Configuration

```python
client = Paychainly(
    api_key="pk_live_...",
    base_url="https://api.paychainly.com",  # default
    timeout=30.0,      # request timeout in seconds
    retries=3,         # retry on 5xx/network errors
    retry_delay=0.5,   # base delay in seconds (exponential backoff)
)
```

## Resources

| `client.<resource>` | Methods |
|---------------------|---------|
| `customers` | `create`, `get`, `get_by_identifier`, `get_by_email`, `get_by_uid`, `get_by_deposit_address`, `list`, `list_all`, `update_by_identifier`, `update_by_email` |
| `addresses` | `generate`, `get`, `get_by_address`, `list`, `list_all`, `revoke`, `revoke_by_address` |
| `transactions` | `get`, `get_by_hash`, `list`, `list_all`, `list_by_address` |
| `payment_links` | `create`, `get`, `get_by_slug`, `get_by_unique_id`, `get_by_address`, `create_for_address`, `list`, `list_all` |
| `invoices` | `get`, `get_by_id`, `get_by_hash` |
| `withdrawals` | `create`, `get`, `list`, `list_all`, `list_by_address`, `cancel` |
| `sandbox` | `credit` |
| `system` | `health` |

## License

MIT
