A no-nonsense Stripe integration by a grumpy dev.
Project description
eldercrank-stripe-core
A no-nonsense Stripe integration library that provides a clean, Pythonic interface to the Stripe API.
Features
- StripeHandler: High-level interface for common Stripe operations including webhook handling
- StripeManager: Comprehensive CRUD operations for products, prices, customers, and subscriptions
- Pydantic Models: Type-safe models for Stripe events, products, and prices
- Clean API: Hides the complexity of working with raw Stripe JSON responses
Installation
pip install eldercrank-stripe-core
Quick Start
Using StripeHandler
from eldercrank.stripe.core import StripeHandler
handler = StripeHandler(
api_key="sk_test_...",
webhook_secret="whsec_..."
)
# Register a webhook handler
def handle_payment_success(event_data):
print(f"Payment successful for customer: {event_data}")
handler.add_event_handler("payment_intent.succeeded", handle_payment_success)
# Process a webhook
event = handler.process_webhook(payload, signature)
# Create a subscription product
result = handler.create_subscription_product(
name="Premium Plan",
amount=1999, # $19.99
currency="usd",
interval="month"
)
Using StripeManager
from eldercrank.stripe.core import StripeManager
manager = StripeManager(api_key="sk_test_...")
# Create a customer
customer = manager.create_customer(
name="John Doe",
email="john@example.com"
)
# Create a product
product = manager.create_product(
name="Basic Plan",
description="Basic subscription plan"
)
# Create a price
price = manager.create_price(
product_id=product["id"],
unit_amount=999,
currency="usd",
recurring={"interval": "month"}
)
# Create a subscription
subscription = manager.create_subscription(
customer_id=customer["id"],
price_id=price["id"]
)
Framework Integrations
- FastAPI: See eldercrank-stripe-fastapi
- Flask: See eldercrank-stripe-flask
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_core-0.1.0b2.tar.gz.
File metadata
- Download URL: eldercrank_stripe_core-0.1.0b2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7baa0fa2e889da32ea60a38d6ba30ca877a0075a76664a1463046854e7405ea3
|
|
| MD5 |
92aca14a305197b5f5bdd48fc46c6c9a
|
|
| BLAKE2b-256 |
fc71f24f95d1b931cb87b4c0355429d1cae2830d812bee73b5094141ba73acaf
|
File details
Details for the file eldercrank_stripe_core-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: eldercrank_stripe_core-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a445e5be93de43c09863d2b389750215260cca344f764dcaa9746751a712c55d
|
|
| MD5 |
76119e66cb0b0bc0fa98db61715b1a1a
|
|
| BLAKE2b-256 |
cf8524760600dc5fbe7778cc3ef890f7eff2a2569fc8fdf596723bb3505bbaac
|