FastAPI integration for the eldercrank-stripe library, providing easy webhook handling for Stripe events in FastAPI applications.
Project description
eldercrank-stripe-fastapi
FastAPI integration for the eldercrank-stripe library, providing easy webhook handling for Stripe events in FastAPI applications.
Features
- Simple Router Creation: One function call to create a webhook router
- Automatic Signature Verification: Handled by the underlying StripeHandler
- Customizable Path: Configure your webhook endpoint path
- Proper Error Handling: Returns appropriate HTTP status codes for Stripe
Installation
pip install eldercrank-stripe-fastapi
Quick Start
from fastapi import FastAPI
from eldercrank.stripe.core import StripeHandler
from eldercrank.stripe.fastapi import create_stripe_router
# Create your Stripe handler
handler = StripeHandler(
api_key="sk_test_...",
webhook_secret="whsec_..."
)
# Create your FastAPI app
app = FastAPI()
# Include the Stripe webhook router
app.include_router(create_stripe_router(handler))
# Register event handlers
def handle_payment_success(event_data):
print(f"Payment successful!")
handler.add_event_handler("payment_intent.succeeded", handle_payment_success)
Custom Webhook Path
# Use a custom webhook path
app.include_router(
create_stripe_router(handler, webhook_path="/stripe/webhook")
)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eldercrank_stripe_fastapi-0.1.0b2.tar.gz.
File metadata
- Download URL: eldercrank_stripe_fastapi-0.1.0b2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
049471c6406168efd34fd8fb0fe6704d9b26cef58158472facc19a87d131b324
|
|
| MD5 |
c086458e5c2aa3b606330c7b98b0ff5d
|
|
| BLAKE2b-256 |
8789ee4493eb302308e5e152bf9ccd0e53ba654e7396ea48f9a023e6171ba961
|
File details
Details for the file eldercrank_stripe_fastapi-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: eldercrank_stripe_fastapi-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
328e3b8f4b1f5768e2a15dd1ba8fc65de89cc65e4de8ccfa57ddf71607283910
|
|
| MD5 |
2fb1672c9b3dcb359c133f49b5299f12
|
|
| BLAKE2b-256 |
f89f8cbe48c647756fdbee348356e406283cdb0675fff3fe309b2b0becc8f2a5
|