Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eldercrank_stripe_flask-0.1.0b2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eldercrank_stripe_flask-0.1.0b2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file eldercrank_stripe_flask-0.1.0b2.tar.gz.

File metadata

File hashes

Hashes for eldercrank_stripe_flask-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 c050748de9f55c632d32dd06c73786ad11573652182b9b7ebd5484cbd0ed0707
MD5 8ad0632fa3c37770624ef2c3a33e872f
BLAKE2b-256 6a53a01827fa75fb078080ad4fd68b2a15373c24328e30a374eab4c42e62e310

See more details on using hashes here.

File details

Details for the file eldercrank_stripe_flask-0.1.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for eldercrank_stripe_flask-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a6e002bb0016028d100accec8163b7db2fc07bbd111305cd8696550a490277f
MD5 52ece8d7fb490a062a1f615b06cfdc42
BLAKE2b-256 8c7d0520f76dbc897771afbe0fd21a6456c5b345394801bc05df156b01867da8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page