Payments
Overview
SpeedPy includes django-paddle-billing for payment processing via Paddle. Paddle handles tax compliance, invoicing, and subscription management.
Installation
The package is already in requirements.txt:
django-paddle-billing==0.1.14
Subscription Plans
Subscription plans are defined in mainapp/subscription_plans.py:
SUBSCRIPTION_PLANS = {
'free': {
'name': 'Free',
}
}
SUBSCRIPTION_PLANS_CHOICES = [
(plan_key, plan_object.get('name'))
for plan_key, plan_object in SUBSCRIPTION_PLANS.items()
]
The Team model has a plan field that references these plans:
class Team(BaseModel):
plan = models.CharField(
max_length=50,
default="free",
choices=SUBSCRIPTION_PLANS_CHOICES,
)
Adding Plans
To add paid plans, extend SUBSCRIPTION_PLANS with your plan details:
SUBSCRIPTION_PLANS = {
'free': {
'name': 'Free',
},
'pro': {
'name': 'Pro',
'max_team_members': 10,
'price_monthly': 29,
},
'enterprise': {
'name': 'Enterprise',
'max_team_members': None, # unlimited
'price_monthly': 99,
},
}
Access plan config from a team:
config = team.get_plan_config()
max_members = config.get('max_team_members')
Paddle Integration
Refer to the django-paddle-billing documentation for setting up:
- Paddle API credentials
- Webhook endpoints
- Checkout integration
- Subscription lifecycle events
Pricing Page
SpeedPy includes a pricing page view at /pricing:
path("pricing", views.PricingView.as_view(), name="pricing"),
Customize the template to display your plans and connect to Paddle checkout.