Metadata-Version: 2.5
Name: nowgate
Version: 0.2.0
Summary: The Nowgate API's Python SDK: payments, payment links, payouts and refunds, with webhook verification. No dependencies.
Keywords: nowgate,payments,crypto,stablecoins,webhooks,sdk
Author: Nowgate
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Office/Business :: Financial
Classifier: Typing :: Typed
License-File: LICENSE
Project-URL: Changelog, https://docs.nowgate.io/changelog
Project-URL: Documentation, https://docs.nowgate.io/sdks/python
Project-URL: Homepage, https://nowgate.io
Project-URL: Issues, https://github.com/Nowgate/nowgate-python/issues
Project-URL: Source, https://github.com/Nowgate/nowgate-python
Import-Name: nowgate

# Nowgate for Python

Nowgate's SDK for its merchant API: payments, payment links, payouts and refunds, with webhook
verification. It needs Python 3.10 or later and nothing outside the standard library, and it is
fully typed: every result is a `TypedDict`, checked by mypy and your editor.

```bash
pip install nowgate
```

## Create a payment

```python
import os

from nowgate import Nowgate

client = Nowgate(api_key=os.environ["NOWGATE_API_KEY"])

payment = client.payments.create(
    network="tron",
    asset="USDT",
    amount="25.00",
    order_id="1042",
    idempotency_key="order-1042",
)
print(payment["id"], payment["deposit"]["address"], payment["amount"])
```

The key picks the API: an `ngk_sandbox_…` key reaches the sandbox and an `ngk_live_…` key the
live API. Amounts are decimal strings (or `Decimal`s), never floats. A failed call is retried
safely with its idempotency key, and lists page with `list_all`.

## Verify a webhook

```python
from nowgate import SignatureVerificationError, Webhook

# body: the request's raw body, exactly as received; signature: its Nowgate-Signature header.
try:
    event = Webhook.construct_event(body, signature, os.environ["NOWGATE_WEBHOOK_SECRET"])
except SignatureVerificationError:
    ...  # answer 400
```

## Documentation

The guides and the API reference are at [docs.nowgate.io](https://docs.nowgate.io), and this
SDK's page is [docs.nowgate.io/sdks/python](https://docs.nowgate.io/sdks/python). The
[changelog](https://docs.nowgate.io/changelog) lists its releases, each with the API version it
was made for.

