Metadata-Version: 2.4
Name: flaxon-stripe
Version: 0.1.0
Summary: Stripe client and webhook verification integration for Flaxon
Author: Aldane Hutchinson
License: MIT
Project-URL: Repository, https://github.com/aldanedev-create/flaxon-stripe
Project-URL: Issues, https://github.com/aldanedev-create/flaxon-stripe/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: AsyncIO
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flaxon>=0.2.0
Requires-Dist: stripe>=10.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# Flaxon Stripe

`flaxon-stripe` exposes a configured Stripe SDK client at
`app.state.stripe`. It also provides a safe webhook signature-verification
helper. It does not create payment routes automatically: applications should
define their own authorization and business rules.

## Install

```bash
pip install flaxon-stripe
```

## Use

```python
import os

from flaxon import Flaxon
from flaxon_stripe import StripePlugin

app = Flaxon("billing")
await app.plugins.load_plugin(
    StripePlugin(
        api_key=os.environ["STRIPE_SECRET_KEY"],
        webhook_secret=os.environ["STRIPE_WEBHOOK_SECRET"],
    )
)


@app.post("/stripe/webhook")
async def stripe_webhook(request):
    event = app.state.stripe.verify_webhook(
        await request.body(),
        request.headers["stripe-signature"],
    )
    return {"received": event["id"]}
```

Use Stripe's official API version configuration, keep both secrets out of
source control, and make webhook processing idempotent. A successful HTTP
response must only be sent after the event has been durably recorded or safely
queued.
