Taking the first payment is the easy part. MoveFast also decides what happens after it, the same way for Stripe, Dodo Payments, and Polar. Every rule below is a setting in one file, src/config/billing.config.ts:
export const BILLING_POLICY: Readonly<BillingPolicy> = {
CANCEL_AT_PERIOD_END: true,
UPGRADE: { timing: PlanChangeTiming.IMMEDIATELY, proration: ProrationPolicy.CHARGE_NOW },
DOWNGRADE: { timing: PlanChangeTiming.AT_PERIOD_END, proration: ProrationPolicy.NONE },
PAYMENT_GRACE_DAYS: 7,
TRIAL_PAYMENT_GRACE_DAYS: 0,
REFUND: RefundPolicy.PRORATED,
CANCEL_DUPLICATE_SUBSCRIPTIONS: true,
DISPUTE: DisputePolicy.SUSPEND_WHEN_OPENED,
ALLOW_DISCOUNT_CODES: true,
};At a Glance
| Question | MoveFast's default | Setting |
|---|---|---|
| 1. Cancel: access ends now or at renewal? | At the end of the paid period | CANCEL_AT_PERIOD_END |
| 2. Mid-cycle upgrade: prorate or surprise? | Applies now; the prorated difference is charged now | UPGRADE |
| 3. Mid-cycle downgrade: features vanish now or later? | Later: the bigger plan stays until the renewal | DOWNGRADE |
| 4. Failed renewal: lock or grace? | 7 days of grace and an email, then access pauses | PAYMENT_GRACE_DAYS |
| 5. Trial converts but the card fails? | Access pauses until the payment goes through | TRIAL_PAYMENT_GRACE_DAYS |
| 6. Annual refund: partial or strict? | Admin refunds the unused part by default | REFUND |
| 7. Price increase: grandfather or force? | Existing subscribers keep their price | Built in |
| 8. Duplicate subscriptions? | Blocked at checkout; a second one is cancelled and refunded | CANCEL_DUPLICATE_SUBSCRIPTIONS |
| 9. Chargeback removes access? | Yes, while the dispute is open; restored if you win | DISPUTE |
| 10. Account deletion stops billing? | Yes: billing stops before anything is deleted | Built in |
| 11. Team owner leaves? | Not applicable: billing is per user | See below |
| 12. Coupon: first invoice or forever? | Set per code; the customer sees how long it lasts | ALLOW_DISCOUNT_CODES |
Who Has Access
One function answers "can this user use paid features right now?": entitlementService.getEntitlement({ userId }). It returns:
{
hasAccess: boolean;
status: "ACTIVE" | "TRIAL" | "CANCELLING" | "GRACE" | "SUSPENDED" | "ENDED" | "NONE";
planId: string | null; // the plan whose features apply now
accessEndsAt: Date | null; // end of a cancelled period or grace period
lossReason: "PAYMENT_FAILED" | "TRIAL_PAYMENT_FAILED" | "DISPUTED" | "CANCELLED" | null;
}Gate paid features with it on the server, never only in the browser:
// A route that only paying users may call: anyone else gets 403.
export const POST = withAuth(hasPaidAccess, async ({ user }) => { ... });
// Or inside a service: throws 402 Payment Required without access.
const { planId } = await entitlementService.requirePaidAccess({ userId: user.id });The browser can read the same answer from GET /api/billing/entitlement to show or hide features. The subscription card on the profile page uses it to explain each state to the customer.
1. Cancel Timing
Customers cancel from the subscription card on their profile page, or from the provider's billing portal. By default they keep access until the period they paid for ends, can resume any time before then, and are not charged again.
A subscription whose payment failed ends at once instead, because waiting would only retry the card. Set CANCEL_AT_PERIOD_END: false to end every cancellation at once.
2. Upgrades
Picking a more expensive plan on the pricing page, while subscribed, offers to switch. An upgrade applies now, and the provider charges the prorated difference for the rest of the period right away. If the card declines, the plan stays as it was.
A change that raises what the customer pays per billing period is an upgrade, so monthly to yearly is an upgrade too. MoveFast compares against what this subscriber actually pays, so a customer on an old, lower price is never mistaken for a downgrade.
UPGRADE.proration can also be NEXT_INVOICE (add the difference to the next bill) or NONE.
3. Downgrades
A downgrade waits for the renewal. The customer keeps the bigger plan, and its features, until the period ends; the renewal then charges the new price and the smaller plan applies. Their subscription card shows the date. Choosing the current plan again before then calls the downgrade off.
4. Failed Renewals
When a renewal payment fails, the provider marks the subscription past due and keeps retrying the card. MoveFast then:
- Records when the payment failed and emails the customer a link to update their card, with the date their access ends.
- Keeps access for
PAYMENT_GRACE_DAYS(7) days. - Pauses paid access after that, until a retry succeeds.
- Ends the subscription if the provider gives up.
A successful retry restores access with no action from you.
5. Trials
Offers with trialDays in src/config/pricing/subscription.config.ts start with a free trial. The sample Starter and Pro offers have 14 days. The card is collected at checkout, and each customer gets one trial: anyone who subscribed before pays from day one.
If the first charge after the trial fails, access pauses at once (TRIAL_PAYMENT_GRACE_DAYS: 0), and the customer gets the same email asking them to update their card. Give them a few days by raising that number.
6. Refunds
Admins refund from Admin Dashboard > Users > View, which lists the user's payments, or with the refund_payment tool of your app's MCP server. Leave the amount empty to refund what REFUND allows:
PRORATED: the unused part of the current period for a subscription payment, such as half of an annual plan six months in, and the full amount of a one-time purchase.FULL: whatever has not been refunded yet.NONE: nothing unless the admin enters an amount.
Tick Also cancel the subscription now so the customer is not charged again. Refunds made in the provider's dashboard are recorded too. A fully refunded one-time purchase takes the plan away.
7. Price Changes
Each subscription stores the price its customer pays, and the subscription card shows it. Raising a price in your pricing config or the provider's dashboard applies to new customers; existing subscribers keep their price until they change plans.
8. Duplicate Subscriptions
Checkout refuses to start a second subscription for someone who already has one, and offers to switch plans instead. If two subscriptions still appear, say from two checkouts at once, MoveFast keeps the older one, cancels the newer one at the provider, refunds its payments, and emails you (WEBSITE.ADMIN_EMAIL).
9. Chargebacks
When a customer's bank opens a dispute, MoveFast marks the payment disputed, pauses that customer's paid access, and emails you so you can respond with evidence in the provider's dashboard.
- Won: the payment counts again and access returns.
- Lost: the subscription is cancelled at the provider, so it is not charged again, and access stays off.
Set DISPUTE: DisputePolicy.SUSPEND_WHEN_LOST to keep access on while the dispute is open.
10. Account Deletion
Customers delete their account from the bottom of the profile page, after typing their email to confirm. MoveFast cancels their subscription at the provider first, at once and without a refund. Only when the provider confirms does it delete the user, their payments, and their subscriptions. If the provider cannot be reached, nothing is deleted and the customer can try again. The provider keeps its own receipts and invoices.
The only admin cannot delete their own account, so your dashboard always has an owner.
11. Team Owners
MoveFast bills people, not teams: each subscription belongs to the user who paid, and only they can change it, so no one can leave a team holding someone else's card.
If you add teams, decide this before you take payments:
- Store the subscription on the team, and record a billing owner who can change the plan and payment method.
- Before the billing owner leaves or deletes their account, make them hand ownership to another admin, or cancel the team's subscription. Never let it keep charging a card whose owner is gone.
- Gate team features on the team's entitlement, and let each member see who pays.
12. Discount Codes
Checkout accepts discount codes while ALLOW_DISCOUNT_CODES is on. You create codes in your provider's dashboard, and each code's duration is set there: once, for a number of months, or forever. The subscription card shows the discount and when it ends, so customers are not surprised when the price goes back up.
Provider Differences
MoveFast applies the same rules with every provider. These are the places where the providers themselves differ:
| Stripe | Dodo Payments | Polar | |
|---|---|---|---|
| Upgrade, charged now | Yes; a declined card leaves the plan as it was | Yes | Yes; a declined card leaves the plan as it was |
| Downgrade at renewal | A subscription schedule switches the price at renewal | Dodo schedules the change for the next billing date | Polar schedules the change for the next period |
NEXT_INVOICE proration | Supported | Charged now: Dodo cannot defer the difference | Supported |
NONE proration | Supported | Supported: the new plan is free until the renewal | The difference goes on the next renewal instead: Polar cannot switch now without prorating |
| Trials | Card collected at checkout | Card collected at checkout; keep the product's "Start the trial without a card" off | Card collected at checkout; a trial set on the product is ignored in favor of trialDays |
| Discount codes | Promotion codes; durations from the coupon; kept on plan changes | Discount codes; subscription_cycles sets the duration; dropped on a plan change unless created with "Preserve on plan change" | Discounts: once, repeating, or forever; dropped at the first renewal after a repeating code ends |
| Existing subscribers' price | Kept: each subscription has its own price | Kept: Dodo never reprices a subscription | Kept: a new price replaces the old one only for new checkouts |
| Refunds | Any amount, any number of times | Per item and tax included; one refund at a time, within 30 days of the payment | Polar refunds before tax and adds tax back, so an amount can come out a cent under |
| Chargebacks | Dispute webhooks; MoveFast suspends and restores access | Dispute webhooks; MoveFast suspends and restores access | No dispute webhooks: Polar refunds to head off a chargeback and ends the subscription when a dispute closes, so DISPUTE has no effect |
| Failed renewals | Smart Retries, then cancel or mark unpaid (your Stripe setting) | Leave Dodo's own grace period off, so PAYMENT_GRACE_DAYS decides | Retries after 2, 7, 14, and 21 days, then ends the subscription |
The webhook events each provider must send are listed under its setup in Payments.
Your App's MCP Server
get_user returns a user's access, current subscription, and recent payments with refunds. refund_payment (with Allow changes) refunds one of those payments. Both answer in the same terms as this page, so an agent can tell you why a customer cannot use a feature, or refund them when you ask.
Test It Locally
With npm run dev running:
npm run webhook:simulate -- refund --email you@example.com
npm run webhook:simulate -- dispute --email you@example.com
npm run webhook:simulate -- dispute --email you@example.com --outcome wonnpm test covers every rule on this page with in-memory fakes, and checks that your provider's real webhooks record refunds, disputes, and failed renewals.
Updating an Existing Project
This release adds columns for prices, trials, plan changes, refunds, and disputes. MongoDB needs nothing. With Supabase, apply the schema once to each database, development first:
npx prisma db push