Flask integration for the eldercrank-stripe library, providing easy webhook handling for Stripe events in Flask applications.
Project description
eldercrank-stripe-flask
Flask integration for the eldercrank-stripe library, providing easy webhook handling for Stripe events in Flask applications.
Features
- Simple Blueprint Creation: One function call to create a webhook blueprint
- Automatic Signature Verification: Handled by the underlying StripeHandler
- Customizable URL Prefix: Configure your webhook endpoint prefix
- Proper Error Handling: Returns appropriate HTTP status codes for Stripe
Installation
pip install eldercrank-stripe-flask
Quick Start
from flask import Flask
from eldercrank.stripe.core import StripeHandler
from eldercrank.stripe.flask import create_stripe_blueprint
# Create your Flask app
app = Flask(__name__)
# Create your Stripe handler
handler = StripeHandler(
api_key="sk_test_...",
webhook_secret="whsec_..."
)
# Register the Stripe webhook blueprint
app.register_blueprint(create_stripe_blueprint(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 URL Prefix
# Use a custom URL prefix
app.register_blueprint(
create_stripe_blueprint(handler, url_prefix="/payments/stripe")
)
This will register the webhook endpoint at /payments/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_flask-0.1.0b2.tar.gz.
File metadata
- Download URL: eldercrank_stripe_flask-0.1.0b2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c050748de9f55c632d32dd06c73786ad11573652182b9b7ebd5484cbd0ed0707
|
|
| MD5 |
8ad0632fa3c37770624ef2c3a33e872f
|
|
| BLAKE2b-256 |
6a53a01827fa75fb078080ad4fd68b2a15373c24328e30a374eab4c42e62e310
|
File details
Details for the file eldercrank_stripe_flask-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: eldercrank_stripe_flask-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a6e002bb0016028d100accec8163b7db2fc07bbd111305cd8696550a490277f
|
|
| MD5 |
52ece8d7fb490a062a1f615b06cfdc42
|
|
| BLAKE2b-256 |
8c7d0520f76dbc897771afbe0fd21a6456c5b345394801bc05df156b01867da8
|