Skip to content

Expand admin-sales-summary with Ultra + products breakdown - #519

Merged
shanerbaner82 merged 1 commit into
mainfrom
feature/admin-mcp-sales-full-breakdown
Sep 12, 2026
Merged

Expand admin-sales-summary with Ultra + products breakdown#519
shanerbaner82 merged 1 commit into
mainfrom
feature/admin-mcp-sales-full-breakdown

Conversation

@shanerbaner82

Copy link
Copy Markdown
Contributor

Summary

  • Expands Admin MCP admin-sales-summary so attributable inbound dollars include Ultra (Cashier Max/Ultra) subscriptions, plugin sales, and first-party product sales — not only PluginLicense + Anystack license counts.
  • Adds breakdown, by_product, ultra (active / comped / window revenue), comped counts, all_time + days up to 3650, and keeps plugin_license_revenue / top_plugins / Anystack license fields for compatibility.
  • Documents that Cashier subscriptions.price_paid is overwritten on invoice paid (renewals do not create rows), matching Filament SubscriberIncomeChart.

Response shape (approx)

{
  "days": 30,
  "all_time": false,
  "since": "",
  "total_revenue_cents": 0,
  "breakdown": [
    { "source": "plugins", "revenue_cents": 0, "sales_count": 0, "currency": "USD" },
    { "source": "products", "revenue_cents": 0, "sales_count": 0, "currency": "USD" },
    { "source": "ultra_subscriptions", "revenue_cents": 0, "sales_count": 0, "currency": "USD", "caveat": "" }
  ],
  "by_product": [{ "product_name": "", "source": "plugins|products", "revenue_cents": 0, "sales_count": 0, "currency": "USD" }],
  "plugin_license_revenue": [{ "currency": "USD", "licenses_count": 0, "revenue_cents": 0 }],
  "top_plugins": [],
  "ultra": {
    "active_count": 0,
    "active_comped_count": 0,
    "created_in_window": 0,
    "paid_created_in_window": 0,
    "revenue_cents_in_window": 0,
    "currency": "USD",
    "caveat": ""
  },
  "nativephp_licenses_created": [],
  "active_nativephp_licenses": 0,
  "comped": { "plugin_count": 0, "product_count": 0, "ultra_active_count": 0 },
  "note": ""
}

Caveats

  • Ultra renewals: price_paid is latest invoice total only; window revenue under-counts renewals.
  • Comps / $0: excluded from paid revenue; counted under comped.
  • Ultra ≠ Anystack policy: plan key max is named Ultra and lives on Cashier subscriptions.

Test plan

  • php artisan test --filter=AdminSalesSummaryTest
  • Pint on dirty files
  • Manual MCP call with days / all_time against staging or local admin OAuth (optional)

Include Ultra Cashier subscriptions plus plugin and first-party product
sales (sales_view), with breakdown, by-product rollups, comps, all_time
lookback, and notes on price_paid renewal limitations.
@shanerbaner82
shanerbaner82 merged commit c270b73 into main Sep 12, 2026
3 checks passed
@shanerbaner82
shanerbaner82 deleted the feature/admin-mcp-sales-full-breakdown branch September 12, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant