Skip to main content

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


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_fastapi-0.1.0b2.tar.gz (4.8 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_fastapi-0.1.0b2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for eldercrank_stripe_fastapi-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 049471c6406168efd34fd8fb0fe6704d9b26cef58158472facc19a87d131b324
MD5 c086458e5c2aa3b606330c7b98b0ff5d
BLAKE2b-256 8789ee4493eb302308e5e152bf9ccd0e53ba654e7396ea48f9a023e6171ba961

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for eldercrank_stripe_fastapi-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 328e3b8f4b1f5768e2a15dd1ba8fc65de89cc65e4de8ccfa57ddf71607283910
MD5 2fb1672c9b3dcb359c133f49b5299f12
BLAKE2b-256 f89f8cbe48c647756fdbee348356e406283cdb0675fff3fe309b2b0becc8f2a5

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