Backend

Billing Integration Template

A template for integrating a payment provider (Stripe, Paddle) with subscription management, webhook handling, plan upgrades/downgrades, and billing portal access.

Template Preview

Copy and use in your project

Integrate [Payment Provider] for subscription billing

As a user who wants to upgrade to a paid plan, I want a smooth checkout experience with clear pricing so that I can unlock premium features and manage my subscription easily.

featureHIGH13 pts

Description

Implement subscription billing using [Stripe/Paddle] including checkout flow, webhook processing, plan management, and billing portal. **Requirements:** - Checkout session creation for new subscriptions - Webhook handler for payment events (subscription created, updated, cancelled, payment failed) - Plan tier enforcement (free vs pro feature gating) - Billing portal redirect for customers to manage their subscription - Subscription status tracking in the database - Grace period handling for failed payments **Plans:** - Free: Limited features, X items/month - Pro ($19/mo): Unlimited features, priority support **Security:** Webhook signatures must be verified using HMAC. Never trust client-side plan data.

Acceptance Criteria

Given I am on the free plan and click 'Upgrade to Pro'

When I complete the checkout flow with the payment provider

Then my account is upgraded to Pro within 30 seconds, premium features are unlocked, and I receive a confirmation email

Given my subscription renews or a payment event occurs

When the payment provider sends a webhook

Then the webhook signature is verified using HMAC and the subscription status in our database is updated accordingly

Given a payment fails for my subscription

When the payment provider notifies us via webhook

Then my account enters a grace period with a banner prompting me to update my payment method before features are restricted

Given I want to manage my subscription (cancel, update card, view invoices)

When I click 'Manage Billing' in my account settings

Then I am redirected to the payment provider's customer portal where I can make changes

Given I attempt to use a Pro-only feature on the free plan

When the feature gate check runs

Then I see an upgrade prompt with the feature's value proposition and a direct link to the checkout page

Import directly into Codepylot

Skip the copy-paste. Codepylot has built-in templates you can use with one click, plus AI that generates even richer stories from your ideas.

Try Codepylot Free

Other Templates

Ready to build your AI agent workforce?

Describe what you want. Your agents write the code. You stay in control.