Prompt
How do I build a store with subscriptions and bundles?
Latest observation
To build a store with subscriptions and bundles, design it around 3 core ideas:
- Products can be sold once or repeatedly
- Bundles are containers of other products
- Subscriptions are recurring contracts tied to a customer and one or more products/services
Here’s a practical way to structure it.
1) Define your product model
Use a flexible product structure with a few product types:
- One-time product: bought once
- Subscription product: billed on a schedule
- Bundle product: contains multiple items, possibly discounted
- Hybrid product: a one-time item plus an optional recurring add-on
Suggested fields
For each product:
idnametype(one_time,subscription,bundle)pricecurrencybilling_interval(for subscriptions: monthly, yearly, etc.)trial_days(optional)activemetadata
For bundles:
bundle_items: list of product IDsbundle_pricing_type: fixed price, sum of items, or discounteddiscount_amount/discount_percent
2) Separate catalog from fulfillment
Don’t mix product listing with actual delivery logic.
Catalog
- What you sell
- Pricing
- Bundle composition
- Subscription plans
Fulfillment
- For one-time items: ship/download/activate once
- For subscriptions: create recurring access and renewals
- For bundles: distribute contained items and handle partial fulfillment
This keeps your system easier to maintain.
3) Model subscriptions properly
A subscription should not just be a product flag. Create a real subscription record.
Subscription entities
- Customer
- Subscription
- Subscription items
- Invoices
- Payments
- Renewals
- Cancellations / pauses
Subscription fields
idcustomer_idstatus(active,trialing,past_due,canceled,paused)start_datenext_billing_dateend_dateplan_idauto_renewpayment_method_id
If a subscription can include multiple products, use subscription line items:
- each item has product ID, quantity, interval, and price
4) Handle bundles as a pricing and fulfillment layer
Bundles can be implemented in a few ways:
Option A: Fixed bundle SKU
- The bundle is a product with its own price
- When purchased, system grants all included items
Best for:
- simple bundles
- easy checkout
Option B: Dynamic bundle
- User chooses components
- Price is calculated from selected items
- Useful for custom boxes or build-your-own kits
Option C: Discounted cart bundle
- Add multiple products to cart
- Apply a discount if specific products are present
Best for:
- marketing promotions
- lightweight implementation
5) Checkout flow
Your checkout should support:
- one-time purchases
- recurring subscriptions
- mixed carts
- bundles
Example flow
- User adds items to cart
- Cart engine determines:
- one-time charges
- subscription charges
- bundle discounts
- Show summary:
- today’s total
- recurring total
- renewal date
- Collect payment method
- Create order + subscription records
- Trigger fulfillment
If you allow mixed carts, be careful to clearly separate:
- initial payment
- recurring payment
- future renewal terms
6) Use an order + subscription separation
A good pattern is:
- Order = purchase event
- Subscription = ongoing billing agreement
Example:
- A customer buys a bundle today
- That creates one order
- If part of it is recurring, it also creates a subscription
This avoids confusing the “thing sold” with the “billing relationship.”
7) Decide how bundles interact with subscriptions
There are a few common cases:
Case 1: Bundle of one-time items
- Simple order
- Fulfill all items immediately
Case 2: Bundle with subscription items
Example: “Starter kit + monthly refills”
- One-time charge for the kit
- Subscription for recurring refills
Case 3: Subscription bundle
Example: “Monthly software suite”
- One subscription, multiple entitlements/features
- Bill as a single recurring plan
Case 4: Bundle discount on subscriptions
Example: “3 services together for 20% off”
- One subscription with multiple line items and one discounted total
8) Payments and billing
Use a recurring billing system that supports:
- saved payment methods
- automatic renewals
- proration
- failed payment retries
- invoices and receipts
Important features:
- retries on failed payments
- dunning emails
- grace periods
- cancellation at period end
- upgrade/downgrade handling
9) Inventory and access control
If you sell physical goods:
- reserve inventory at checkout
- decrement inventory on successful payment
- handle bundle components individually
If you sell digital goods/services:
- grant entitlements
- tie access to active subscriptions
- revoke on cancellation or expiration
For bundles:
- one bundle purchase may grant multiple access rights
- track each entitlement separately if needed
10) Recommended database tables
A simple schema might include:
usersproductsbundle_itemsordersorder_itemssubscriptionssubscription_itemsinvoicespaymentsentitlementsrefunds
Example relationships
ordershave manyorder_itemssubscriptionshave manysubscription_itemsbundle_itemslink a bundle product to child productsentitlementsgrant access to products or services
11) Tech stack suggestion
You can build this with almost any modern stack. A common setup:
- Frontend: React / Next.js
- Backend: Node.js, Python, Ruby, or Go
- Database: PostgreSQL
- Payments: Stripe, Paddle, Braintree, etc.
- Jobs/queues: for renewals, reminders, and retries
- Email: SendGrid, Postmark, etc.
If you want subscriptions, using a billing provider is strongly recommended rather than building payments from scratch.
12) Minimum viable version
If you want a simpler first release:
MVP
- One-time products
- One subscription product type
- Fixed bundles
- Stripe billing
- Simple order creation
- Basic entitlement tracking
Later
- Build-your-own bundles
- Proration
- Coupons
- Trials
- Pause/resume subscriptions
- Multi-item subscriptions
- Usage-based billing
13) Example business rule set
Here’s a simple rules model:
- A bundle can contain products of any type
- A subscription product must have an interval
- A bundle can be:
- one-time only
- recurring only
- mixed
- A subscription can be:
- created from a single product
- created from a bundle
- created from selected subscription items in the cart
14) Practical implementation advice
Start with these decisions:
- Can bundles contain subscriptions?
- Can carts mix one-time and recurring items?
- Are bundles fixed or customizable?
- Do you need proration?
- Will physical inventory be involved?
- Will one subscription cover multiple products or one per product?
These answers shape the architecture.
If you want, I can also give you:
- a database schema
- a checkout flow diagram
- or a sample implementation in Stripe + Next.js