Prompt
I'm building a subscription platform and need tax-inclusive pricing plus refund handling
Latest observation
Here’s a practical way to design tax-inclusive pricing and refund handling for a subscription platform.
1) Tax-inclusive pricing: core idea
If your displayed price is tax-inclusive, the customer sees and pays one final amount, and you later split it into:
- Net amount (your revenue before tax)
- Tax amount (what you owe/remit)
Formula
For a tax rate r and gross price G:
- Net =
G / (1 + r) - Tax =
G - Net
Example at 20% VAT with a gross price of $120:
- Net =
120 / 1.2 = 100 - Tax =
20
2) Multiple tax rates
Your platform may need different tax rates depending on:
- Customer country/state/province
- Product type
- Business vs consumer
- Tax exemption status
- Local rules for digital services/subscriptions
Recommendation
Store pricing in a way that supports:
- Gross list price
- Jurisdiction-based tax rate lookup
- Per-invoice tax breakdown
- Rounded amounts
3) Subscription billing flow
At signup / renewal:
- Determine customer tax jurisdiction
- Fetch applicable tax rate
- Use the gross displayed price
- Calculate net + tax
- Create invoice/receipt with breakdown
Suggested stored fields
plan_gross_amountcurrencytax_countrytax_regiontax_ratenet_amounttax_amountgross_amountinvoice_idbilling_period_startbilling_period_end
4) Rounding rules
Tax-inclusive pricing often creates rounding issues, especially with:
- Monthly subscriptions
- Proration
- Discounts
- Multi-line invoices
Best practice
- Round at the line-item level or follow local tax law requirements
- Use decimal arithmetic, not floating-point
- Keep a consistent rounding mode, usually half-up, unless regulation says otherwise
Example:
- Gross = $9.99
- Tax rate = 20%
- Net = 9.99 / 1.2 = 8.325
- Tax = 1.665
Rounded:
- Net = $8.33
- Tax = $1.66
- Total = $9.99
5) Discounts
If a coupon reduces the subscription price, decide whether it applies to:
- Gross price before tax
- Net price before tax
- Or tax-exclusive amount
Common approach
Apply discounts to the gross price, then re-calculate net/tax from the discounted gross.
This is simplest for tax-inclusive storefronts.
6) Refund handling
Refunds should usually mirror the original transaction’s tax treatment.
If fully refunded:
- Refund gross amount
- Reverse associated tax amount
- Reduce recognized revenue accordingly
If partially refunded:
- Allocate refund proportionally across:
- net amount
- tax amount
- Ensure the tax refund matches the refunded service amount
Example
Original invoice:
- Gross: $120
- Net: $100
- Tax: $20
Partial refund of 25%:
- Refund gross: $30
- Refund net: $25
- Refund tax: $5
7) Refunds for unused subscription time
For subscriptions, refunds may be:
- Prorated for unused time
- Non-refundable depending on policy
- Required by local consumer law in some jurisdictions
Proration formula
If a billing period is T days and U unused days:
- Refund gross =
gross_amount * (U / T) - Refund net/tax = same ratio, then round carefully
8) Credit notes
For tax compliance, refunds should often generate a credit note or refund invoice referencing the original invoice.
Include:
- Original invoice number
- Refunded line items
- Gross refund amount
- Net adjustment
- Tax adjustment
- Reason for refund
9) Edge cases to plan for
- Customer changes country mid-subscription
- Tax rate changes during a billing cycle
- Refund after tax filing period ends
- Chargeback vs voluntary refund
- Multi-currency subscriptions
- Tax-exempt customers
- Trials converting to paid plans
- Annual plans refunded monthly/partially
10) Suggested data model
subscriptions
idcustomer_idplan_idbilling_currencygross_pricetax_inclusivebooleantax_location
invoices
idsubscription_idgross_totalnet_totaltax_totaltax_ratestatus
refunds
idinvoice_idgross_refundnet_refundtax_refundreasoncreated_at
11) Implementation tips
- Use a dedicated tax service or provider if you operate in multiple jurisdictions
- Persist the tax rate used at invoice time; don’t recalculate later from current rates
- Store all monetary values in the smallest currency unit if possible
- Keep audit logs for tax calculations and refunds
- Validate refund totals against original invoice totals
If you want, I can also give you:
- a database schema,
- a billing/refund algorithm, or
- example code in Python/Node/TypeScript.