Macrofit Dev Reference
Billing Logic Reference

Billing Logic

The authoritative reference for all billing formulas, plan rules, and test environment configuration. All dev work must conform to these specifications.

Plan Overview

Monthly Plan

$109/cycle

Commitment: No commitment — cancel anytime

Charges: Indefinite charges every 28 days

Cancellation stops all future charges immediately.

3-Month Plan

$89/cycle

Commitment: 3-charge commitment

Charges: C1, C2, C3 — all 3 fire regardless of cancellation

Customer can cancel anytime but all 3 charges still fire. Access ends C3 + 35 days.

6-Month Plan

$74/cycle

Commitment: 6-charge commitment

Charges: C1–C6 — all 6 fire regardless of cancellation

Customer can cancel anytime but all 6 charges still fire. Access ends C6 + 35 days.

Charge Schedule

EventFormulaNotes
Charge 1 (C1)Payment date — fires when customer signs upAlways precedes the start date.
Charge 2 (C2)Start Date + 21 daysAnchored to program start date, NOT to C1 payment date. This is the most commonly misunderstood rule.
Charge 3+ (C3–C6)Previous charge + 28 daysEach subsequent charge is exactly 28 days after the prior one.
Access WindowFinal charge date + 35 days (5 weeks)Applies to all plans. After this date, access is revoked.

Correct Implementation

Correct formula — all plans

// CORRECT — universal formula for all accounts and all plans charge1 = payment_date // day of signup charge2 = start_date + 21 days // anchored to START DATE, not C1 charge3 = charge2 + 28 days charge4 = charge3 + 28 days // (3-Month stops after charge3) charge5 = charge4 + 28 days charge6 = charge5 + 28 days // (6-Month stops after charge6) expiry = final_charge + 35 days // Monthly: charge2 onward repeats every 28 days until cancelled

Known Wrong Formulas (Do Not Use)

Bug Pattern A — calendar months (older accounts)

// WRONG — Pattern A (older accounts, pre-April 2026) expiry = start_date + N_calendar_months - 1_day // Problem: calendar months ≠ 28-day billing cycle // 6 calendar months ≈ 182 days vs. 168 days actual (6×28) // Results in expiry 1–15 days LATE

Bug Pattern B — off-by-one day (newer accounts)

// WRONG — Pattern B (newer accounts, April 2026) expiry = final_charge + 34 days // for 6-month expiry = final_charge + 27 days // for 3-month // Problem: should be +35 days for both // Results in expiry 1–8 days EARLY

Key Rules

Payment precedes start date

The customer pays at signup and then selects their program start date. The billing cycle is anchored to the start date, not the payment date.

C2 is anchored to Start Date, not C1

This is the most commonly implemented incorrectly. C2 = Start Date + 21 days. It is NOT C1 + 21 days or C1 + 28 days.

Commitment charges fire regardless of cancellation

On 3-Month and 6-Month plans, all commitment charges fire even if the customer cancels on Day 1. The cancellation only prevents auto-renewal after the commitment period ends.

Expiry = Final Charge + 35 days

This applies to all plans. 35 days = 5 weeks. This is not 30 days, not 1 calendar month, not the start date + N months.

Monthly plan has no commitment

Monthly customers can cancel anytime and the next charge simply does not fire. No commitment period applies.

Grandfathered Premium accounts

Accounts created before the new pricing launched are on the old Premium plan. They are unaffected by the new billing system and should not be modified.

Final week meal selection rule

In the last 7 days before expiry, 'Next Week' meal selection is blocked. 'This Week' remains accessible until expiry.

Meal preview rule

Customers can preview meals 7 days before their program Start Date.

Test Environment Configuration

1 real day = 7 days (1 week) in the test environment

All billing formulas are preserved — the clock just runs 7× faster. No formulas are bypassed or approximated.

Acceleration1 real day = 7 days (1 week) in the test environment
Why it worksAll real billing formulas are preserved. The clock just runs 7× faster — no formulas are bypassed.
C2 in test envFires 3 real days after Start Date (21 ÷ 7 = 3)
C3+ in test envEach subsequent charge fires 4 real days after the previous (28 ÷ 7 = 4)
Expiry in test envFires 5 real days after the last charge (35 ÷ 7 = 5)
Full 6-Month lifecycle~24 real days to complete (C1 → C6 → Expiry)
Full 3-Month lifecycle~16 real days to complete (C1 → C3 → Expiry)
Dataset sizeKeep staging dataset small — cron job timed out with too many records, causing late-firing charges in previous testing.
Test start dateAll new test accounts use Start Date: April 27, 2026 so all charges fire on the same timeline.

Macrofit Internal — Billing Logic Reference · For dev team use only