- {subscription.plan_name ?? t('Unknown Plan')}
+ {subscription.plan_name ??
+ t('Unknown Plan')}
{subscription.amount !== null && (
@@ -290,7 +300,8 @@ export default function SettingsBilling({
)}
{subscription.interval && (
- {(subscription.interval_count ?? 1) > 1
+ {(subscription.interval_count ??
+ 1) > 1
? t('every :count :interval', {
count: String(
subscription.interval_count,
@@ -604,6 +615,9 @@ export default function SettingsBilling({
{t('Date')}
|
+
+ {t('Item')}
+ |
{t('Amount')}
|
@@ -626,6 +640,9 @@ export default function SettingsBilling({
longDate,
)}
+
+ {payment.name ?? '—'}
+ |
{formatMoney(
payment.amount,
diff --git a/resources/js/types/index.ts b/resources/js/types/index.ts
index 12fa4b7..8058c84 100644
--- a/resources/js/types/index.ts
+++ b/resources/js/types/index.ts
@@ -26,11 +26,12 @@ export interface Price {
/**
* What a pricing card's button does, decided on the server (`PlanActions`).
* Mirrors the PHP `PlanAction` enum; change one, change the other. `buy`,
- * `trial`, `signup`, `change` and `contact` act; `owner_only` explains who can; the rest
+ * `buy_again`, `trial`, `signup`, `change` and `contact` act; `owner_only` explains who can; the rest
* are disabled labels.
*/
export type PlanAction =
| 'buy'
+ | 'buy_again'
| 'signup'
| 'change'
| 'contact'
@@ -116,6 +117,8 @@ export interface LifetimePlan {
/** A one-time payment: a lifetime plan's only record, since it has no invoice. */
export interface OneTimePayment {
id: number;
+ /** The plan bought; null once its price is gone. */
+ name: string | null;
amount: number;
currency: string;
status: 'succeeded' | 'refunded';
diff --git a/resources/js/vue/components/ProductCard.vue b/resources/js/vue/components/ProductCard.vue
index 5ebc321..e96cae8 100644
--- a/resources/js/vue/components/ProductCard.vue
+++ b/resources/js/vue/components/ProductCard.vue
@@ -30,7 +30,10 @@ const ctaClass = computed(() =>
);
const startsCheckout = computed(
- () => props.action === 'buy' || props.action === 'trial',
+ () =>
+ props.action === 'buy' ||
+ props.action === 'buy_again' ||
+ props.action === 'trial',
);
const enabled = computed(
@@ -247,6 +250,9 @@ watch(priceKey, () => {
{{
$t('Ask an owner')
}}
+ {{
+ $t('Buy again')
+ }}
{{
$t('Start :days-day free trial', {
days: String(product.trial_days ?? 0),
diff --git a/resources/js/vue/pages/SettingsBilling.vue b/resources/js/vue/pages/SettingsBilling.vue
index 8b2efe9..9b880ad 100644
--- a/resources/js/vue/pages/SettingsBilling.vue
+++ b/resources/js/vue/pages/SettingsBilling.vue
@@ -592,7 +592,10 @@ function resumeSubscription() {
-
+
{{ $t('Cancellation') }}
@@ -646,6 +649,11 @@ function resumeSubscription() {
>
{{ $t('Date') }}
+
+ {{ $t('Item') }}
+ |
@@ -670,6 +678,9 @@ function resumeSubscription() {
formatDate(payment.paid_at, language, longDate)
}}
| |
+
+ {{ payment.name ?? '—' }}
+ |
diff --git a/src/Enums/PlanAction.php b/src/Enums/PlanAction.php
index 0143c98..db75ec2 100644
--- a/src/Enums/PlanAction.php
+++ b/src/Enums/PlanAction.php
@@ -11,6 +11,9 @@ enum PlanAction: string
/** Checkout, paid from the start. */
case Buy = 'buy';
+ /** Checkout for a one-off the owner already bought: another call, renewed updates. */
+ case BuyAgain = 'buy_again';
+
/** Checkout with the plan's free trial. */
case Trial = 'trial';
diff --git a/src/Services/PlanActions.php b/src/Services/PlanActions.php
index 4005c16..66d91c8 100644
--- a/src/Services/PlanActions.php
+++ b/src/Services/PlanActions.php
@@ -5,9 +5,11 @@
use App\Models\User;
use Illuminate\Support\Collection;
use Modules\Billing\Contracts\BillingOwner;
+use Modules\Billing\Enums\PaymentStatus;
use Modules\Billing\Enums\PlanAction;
use Modules\Billing\Enums\PlanKind;
use Modules\Billing\Enums\PurchaseRefusal;
+use Modules\Billing\Models\Price;
use Modules\Billing\Models\Product;
/**
@@ -37,7 +39,7 @@ public function for(?BillingOwner $owner, Collection $plans, ?User $viewer = nul
}
return array_map(fn (array $byId): array => array_map(
- fn (PlanAction $action): PlanAction => in_array($action, [PlanAction::Buy, PlanAction::Trial, PlanAction::Change], true) ? PlanAction::OwnerOnly : $action,
+ fn (PlanAction $action): PlanAction => in_array($action, [PlanAction::Buy, PlanAction::BuyAgain, PlanAction::Trial, PlanAction::Change], true) ? PlanAction::OwnerOnly : $action,
$byId,
), $actions);
}
@@ -53,6 +55,7 @@ private function actionsFor(?BillingOwner $owner, Collection $plans): array
// Once per page, not once per price, and only if a trial is on offer: it is two queries.
$hasTrialed = $plans->contains(fn (Product $plan) => $plan->trial_days > 0)
&& ($owner?->billingAccount()?->hasTrialed() ?? false);
+ $boughtOneOffs = $this->boughtOneOffs($owner, $plans);
foreach ($plans as $plan) {
if ($plan->kind === PlanKind::Free) {
@@ -69,7 +72,12 @@ private function actionsFor(?BillingOwner $owner, Collection $plans): array
// A trial is still a purchase; only the button reads differently,
// so eligibility stays out of it.
$priceActions[$price->id] = $action
- ?? ($refusal === null && $plan->trial_days > 0 && ! $hasTrialed ? PlanAction::Trial : $this->priceAction($refusal));
+ ?? match (true) {
+ $refusal !== null => $this->priceAction($refusal),
+ $plan->trial_days > 0 && ! $hasTrialed => PlanAction::Trial,
+ in_array($plan->id, $boughtOneOffs, true) => PlanAction::BuyAgain,
+ default => PlanAction::Buy,
+ };
}
if ($plan->prices->isEmpty()) {
@@ -80,6 +88,32 @@ private function actionsFor(?BillingOwner $owner, Collection $plans): array
return ['priceActions' => $priceActions, 'productActions' => $productActions];
}
+ /**
+ * The one-offs on this page the owner holds a payment for, refunds aside. One query.
+ *
+ * @param Collection $plans
+ * @return list
+ */
+ private function boughtOneOffs(?BillingOwner $owner, Collection $plans): array
+ {
+ $oneOffs = $plans->filter(fn (Product $plan) => $plan->kind === PlanKind::OneOff);
+ $account = $oneOffs->isEmpty() ? null : $owner?->billingAccount();
+
+ if ($account === null) {
+ return [];
+ }
+
+ // Through every price the plan ever had: a page shows only active ones, and a
+ // purchase under a replaced price is still a purchase.
+ return Price::query()
+ ->whereIn('product_id', $oneOffs->pluck('id'))
+ ->whereIn('id', $account->payments()->where('status', PaymentStatus::Succeeded)->select('price_id'))
+ ->distinct()
+ ->pluck('product_id')
+ ->map(fn ($id) => (int) $id)
+ ->all();
+ }
+
private function priceAction(?PurchaseRefusal $refusal): PlanAction
{
return match ($refusal) {
diff --git a/src/Settings/BillingSection.php b/src/Settings/BillingSection.php
index 0a05b1c..bf2ee87 100644
--- a/src/Settings/BillingSection.php
+++ b/src/Settings/BillingSection.php
@@ -148,9 +148,11 @@ public function props(): array
->whereIn('status', [PaymentStatus::Succeeded, PaymentStatus::Refunded])
->latest('id')
->limit(20)
+ ->with('price.plan')
->get()
->map(fn (Payment $payment) => [
'id' => $payment->id,
+ 'name' => $payment->price?->plan?->name,
'amount' => $payment->amount,
'currency' => $payment->currency->value,
'status' => $payment->status->value,
diff --git a/tests/Feature/BillingPanelTest.php b/tests/Feature/BillingPanelTest.php
index f1684c8..ee806c8 100644
--- a/tests/Feature/BillingPanelTest.php
+++ b/tests/Feature/BillingPanelTest.php
@@ -123,6 +123,17 @@ public function test_one_time_payments_are_listed_and_subscription_payments_are_
$this->assertSame('refunded', $payments[0]['status']);
}
+ /** A row says what was bought, even once the plan is archived. */
+ public function test_a_one_time_payment_names_what_was_bought(): void
+ {
+ $price = Price::factory()->oneTime()->create();
+ $price->product->update(['name' => 'Onboarding call']);
+ $price->product->delete();
+ Payment::factory()->create(['customer_id' => $this->customer->id, 'price_id' => $price->id]);
+
+ $this->assertSame('Onboarding call', $this->props()['payments'][0]['name']);
+ }
+
public function test_a_subscription_lifetime_replaces_says_so_once_its_end_is_scheduled(): void
{
$this->subscribeToPro(['cancelled_at' => now(), 'ends_at' => now()->addWeek()]);
diff --git a/tests/Feature/PlanActionsTest.php b/tests/Feature/PlanActionsTest.php
index 5f07e79..945adce 100644
--- a/tests/Feature/PlanActionsTest.php
+++ b/tests/Feature/PlanActionsTest.php
@@ -105,6 +105,39 @@ public function test_the_owner_viewing_their_own_plan_acts_on_it(): void
$this->assertSame(PlanAction::Buy, $actions['priceActions'][$this->priceOf($this->pro)->id]);
}
+ /** A one-off can be bought again (another call, renewed package updates); the button says so. */
+ public function test_a_one_off_already_bought_is_offered_again(): void
+ {
+ $call = Product::factory()->oneOff()->create();
+ $price = Price::factory()->oneTime()->create(['product_id' => $call->id]);
+ Payment::factory()->create(['customer_id' => $this->customer->id, 'price_id' => $price->id]);
+
+ $this->assertSame(PlanAction::BuyAgain, $this->actions($this->user, $call)['priceActions'][$price->id]);
+ }
+
+ /** Bought under a price that has since been replaced: still a repeat purchase. */
+ public function test_a_one_off_bought_under_a_retired_price_is_offered_again(): void
+ {
+ $call = Product::factory()->oneOff()->create();
+ $old = Price::factory()->oneTime()->create(['product_id' => $call->id, 'is_active' => false]);
+ $new = Price::factory()->oneTime()->create(['product_id' => $call->id]);
+ Payment::factory()->create(['customer_id' => $this->customer->id, 'price_id' => $old->id]);
+
+ $plan = $call->fresh()->setRelation('prices', $new->newCollection([$new]));
+ $actions = app(PlanActions::class)->for($this->user, collect([$plan]));
+
+ $this->assertSame(PlanAction::BuyAgain, $actions['priceActions'][$new->id]);
+ }
+
+ public function test_a_refunded_one_off_is_bought_as_new(): void
+ {
+ $call = Product::factory()->oneOff()->create();
+ $price = Price::factory()->oneTime()->create(['product_id' => $call->id]);
+ Payment::factory()->refunded()->create(['customer_id' => $this->customer->id, 'price_id' => $price->id]);
+
+ $this->assertSame(PlanAction::Buy, $this->actions($this->user, $call)['priceActions'][$price->id]);
+ }
+
public function test_a_user_with_nothing_bought_is_on_free(): void
{
$this->assertSame(PlanAction::Current, $this->actions($this->user, $this->free)['priceActions'][$this->priceOf($this->free)->id]);
From 835f63dd8cdcfed04176cc22d0930f71b3328846 Mon Sep 17 00:00:00 2001
From: roble
Date: Tue, 10 Nov 2026 11:24:05 +0000
Subject: [PATCH 3/9] test: assert behaviour, not copy or design
Customers translate, reword and restyle a starter kit; tests now check
test ids, data-state, URLs, counts and the data they create.
Co-Authored-By: Claude Opus 5.5
---
resources/js/react/pages/SettingsBilling.tsx | 5 +--
resources/js/vue/pages/SettingsBilling.vue | 5 +--
tests/Feature/DashboardWidgetsTest.php | 36 +++++++++++++------
tests/Feature/PlanKindExplainedTest.php | 8 +++--
tests/e2e/tests/plans/plans.spec.ts | 8 +++--
.../settings-billing.basic.spec.ts | 6 ++--
.../settings-billing.lifetime.spec.ts | 9 ++---
7 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/resources/js/react/pages/SettingsBilling.tsx b/resources/js/react/pages/SettingsBilling.tsx
index 81472fa..626b1df 100644
--- a/resources/js/react/pages/SettingsBilling.tsx
+++ b/resources/js/react/pages/SettingsBilling.tsx
@@ -241,7 +241,7 @@ export default function SettingsBilling({
{plan.paid_at && (
- <>
+
{t('Bought on :date', {
date: formatDate(
plan.paid_at,
@@ -250,7 +250,7 @@ export default function SettingsBilling({
),
})}{' '}
·{' '}
- >
+
)}
{t('Yours for good, no renewals.')}
@@ -268,6 +268,7 @@ export default function SettingsBilling({
{subscription.interval
diff --git a/resources/js/vue/pages/SettingsBilling.vue b/resources/js/vue/pages/SettingsBilling.vue
index 9b880ad..b261423 100644
--- a/resources/js/vue/pages/SettingsBilling.vue
+++ b/resources/js/vue/pages/SettingsBilling.vue
@@ -194,14 +194,14 @@ function resumeSubscription() {
-
+
{{
$t('Bought on :date', {
date: formatDate(plan.paid_at, language, longDate),
})
}}
·
-
+
{{ $t('Yours for good, no renewals.') }}
@@ -214,6 +214,7 @@ function resumeSubscription() {
{{
diff --git a/tests/Feature/DashboardWidgetsTest.php b/tests/Feature/DashboardWidgetsTest.php
index 5aa94ce..6ed2d33 100644
--- a/tests/Feature/DashboardWidgetsTest.php
+++ b/tests/Feature/DashboardWidgetsTest.php
@@ -3,11 +3,14 @@
namespace Modules\Billing\Tests\Feature;
use App\Models\User;
+use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Exceptions;
use Livewire\Livewire;
use Modules\Billing\Filament\Pages\BillingDashboard;
+use Modules\Billing\Filament\Resources\Products\ProductResource;
+use Modules\Billing\Filament\Resources\Subscriptions\SubscriptionResource;
use Modules\Billing\Filament\Widgets\BillingAttentionWidget;
use Modules\Billing\Filament\Widgets\BillingHealthWidget;
use Modules\Billing\Filament\Widgets\BillingSaasStatsWidget;
@@ -63,25 +66,26 @@ public function test_the_headline_cards_compare_with_the_previous_period(): void
Payment::factory()->create(['amount' => 3000, 'amount_refunded' => 0, 'created_at' => '2026-11-05']);
Payment::factory()->create(['amount' => 1000, 'amount_refunded' => 0, 'created_at' => '2026-10-28']);
- Livewire::test(BillingSaasStatsWidget::class, self::WEEK)
- ->assertSee(['Revenue', '+200% vs previous period', 'MRR', 'New subscriptions']);
+ Livewire::test(BillingSaasStatsWidget::class, self::WEEK)->assertSee('+200%');
+ $this->assertCount(3, $this->stats(BillingSaasStatsWidget::class));
Exceptions::assertNothingReported();
}
/** A new install has no plans: one pointer to set billing up, not a row of zeros. */
public function test_without_plans_the_headline_says_how_to_start(): void
{
- Livewire::test(BillingSaasStatsWidget::class, self::WEEK)
- ->assertSee('Set up billing')
- ->assertDontSee('MRR');
+ $stats = $this->stats(BillingSaasStatsWidget::class);
+
+ $this->assertCount(1, $stats);
+ $this->assertSame(ProductResource::getUrl('create'), $stats[0]->getUrl());
}
public function test_the_health_cards(): void
{
Subscription::factory()->create();
- Livewire::test(BillingHealthWidget::class, self::WEEK)
- ->assertSee(['Active subscriptions', 'Churn', 'ARPU', 'Checkout conversion', 'Refunds', 'Failed payments']);
+ Livewire::test(BillingHealthWidget::class, self::WEEK)->assertOk();
+ $this->assertCount(6, $this->stats(BillingHealthWidget::class));
Exceptions::assertNothingReported();
}
@@ -108,7 +112,8 @@ public function test_attention_shows_only_with_something_to_do(): void
Payment::factory()->failed()->create();
$this->assertTrue(BillingAttentionWidget::canView());
- Livewire::test(BillingAttentionWidget::class)->assertSee(['Past due subscriptions', 'Failed payments']);
+ Livewire::test(BillingAttentionWidget::class)->assertOk();
+ $this->assertSame([1, 1], array_map(fn ($stat) => $stat->getValue(), $this->stats(BillingAttentionWidget::class)));
}
/** A zero isn't something to attend to. */
@@ -116,8 +121,17 @@ public function test_attention_lists_only_what_needs_doing(): void
{
Subscription::factory()->pastDue()->create();
- Livewire::test(BillingAttentionWidget::class)
- ->assertSee('Past due subscriptions')
- ->assertDontSee('Failed payments');
+ $stats = $this->stats(BillingAttentionWidget::class);
+
+ $this->assertCount(1, $stats);
+ $this->assertSame(SubscriptionResource::getUrl('index'), $stats[0]->getUrl());
+ }
+
+ /** @return array The cards, read without their translated labels. */
+ private function stats(string $widget): array
+ {
+ $instance = tap(new $widget, fn ($w) => $w->pageFilters = self::WEEK['pageFilters']);
+
+ return (fn () => $this->getStats())->call($instance);
}
}
diff --git a/tests/Feature/PlanKindExplainedTest.php b/tests/Feature/PlanKindExplainedTest.php
index 074ecab..0213fb4 100644
--- a/tests/Feature/PlanKindExplainedTest.php
+++ b/tests/Feature/PlanKindExplainedTest.php
@@ -57,8 +57,12 @@ public function test_a_sold_plan_says_it_is_fixed_and_still_explains_its_kind():
Subscription::factory()->create(['price_id' => Price::factory()->for($plan)->create()->id]);
Livewire::test(EditProduct::class, ['record' => $plan->getKey()])
- ->assertSee('Fixed: this plan has been sold.')
- ->assertSee(PlanKind::Subscription->description());
+ ->assertSee(PlanKind::Subscription->description())
+ ->fillForm(['kind' => PlanKind::OneOff])
+ ->call('save');
+
+ // Fixed once sold: the disabled field never saves.
+ $this->assertSame(PlanKind::Subscription, $plan->fresh()->kind);
}
#[DataProvider('kinds')]
diff --git a/tests/e2e/tests/plans/plans.spec.ts b/tests/e2e/tests/plans/plans.spec.ts
index fa395e8..878b605 100644
--- a/tests/e2e/tests/plans/plans.spec.ts
+++ b/tests/e2e/tests/plans/plans.spec.ts
@@ -71,7 +71,9 @@ test.describe.parallel('Pricing page', () => {
).toHaveAttribute('data-action', 'buy');
});
- test('opens signup over pricing when a guest picks a free plan', async ({ page }) => {
+ test('opens signup over pricing when a guest picks a free plan', async ({
+ page,
+ }) => {
await page.goto('/pricing');
await page
.getByTestId('product-card-starter')
@@ -81,7 +83,9 @@ test.describe.parallel('Pricing page', () => {
await expect(page.getByTestId('register-modal')).toBeVisible();
});
- test('opens signup over pricing when a guest picks a paid plan', async ({ page }) => {
+ test('opens signup over pricing when a guest picks a paid plan', async ({
+ page,
+ }) => {
await page.goto('/pricing');
await page
diff --git a/tests/e2e/tests/settings-billing/settings-billing.basic.spec.ts b/tests/e2e/tests/settings-billing/settings-billing.basic.spec.ts
index 4991123..239d9ba 100644
--- a/tests/e2e/tests/settings-billing/settings-billing.basic.spec.ts
+++ b/tests/e2e/tests/settings-billing/settings-billing.basic.spec.ts
@@ -41,9 +41,11 @@ test.describe.parallel('Settings Billing Basics', () => {
const billingPage = new SettingsBillingPage(page);
await billingPage.goto();
await billingPage.expectPlanName('Pro');
- await expect(page.getByTestId('plan-kind')).toHaveText('Monthly plan');
+ await expect(page.getByTestId('plan-kind')).toHaveAttribute(
+ 'data-interval',
+ /^month/,
+ );
await expect(page.getByTestId('plan-amount')).toContainText('29.00');
- await expect(page.getByTestId('plan-amount')).toContainText('month');
await expect(billingPage.cancelButton).toBeVisible();
await expect(
page.getByTestId('danger-zone').getByTestId('cancel-button'),
diff --git a/tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts b/tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts
index 5d50aad..4b51e4a 100644
--- a/tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts
+++ b/tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts
@@ -18,19 +18,16 @@ test.describe('Settings Billing Lifetime', () => {
await billingPage.goto();
const plan = page.getByTestId('lifetime-plan');
- await expect(plan.getByTestId('lifetime-plan-kind')).toHaveText(
- 'Lifetime plan',
- );
+ await expect(plan.getByTestId('lifetime-plan-kind')).toBeVisible();
await expect(plan.getByTestId('lifetime-plan-name')).toHaveText(
'Lifetime E2E',
);
await expect(plan.getByTestId('lifetime-plan-amount')).toContainText(
'299.00',
);
- await expect(plan).toContainText('Paid once');
- await expect(plan).toContainText('Bought on');
+ await expect(plan.getByTestId('lifetime-plan-paid-at')).toBeVisible();
+ // Feature names are the fixture's data; the second hides behind the toggle.
await expect(plan).toContainText('Unlimited projects');
- await expect(plan).toContainText('+1 more');
await expect(plan).not.toContainText('Priority support');
const featuresToggle = plan.getByTestId('plan-features-toggle');
From edbb6b1a470f6ed448865248564c9b80542ad62c Mon Sep 17 00:00:00 2001
From: roble
Date: Tue, 10 Nov 2026 16:10:53 +0000
Subject: [PATCH 4/9] refactor: demo seeders become the showcase state
Demo*Seeder is now Showcase*, run by modules:seed --state=showcase.
Co-Authored-By: Claude Opus 5.5
---
README.md | 2 +-
Taskfile.yml | 4 ++--
...eeder.php => ShowcaseBillingDatabaseSeeder.php} | 12 ++++++------
...stomerSeeder.php => ShowcaseCustomerSeeder.php} | 4 ++--
...ProductSeeder.php => ShowcaseProductSeeder.php} | 4 ++--
...onSeeder.php => ShowcaseSubscriptionSeeder.php} | 6 +++---
.../skills/saucebase-billing-development/SKILL.md | 14 +++++++-------
.../{DemoSeederTest.php => ShowcaseSeederTest.php} | 14 +++++++-------
.../{DemoStaffTest.php => ShowcaseStaffTest.php} | 8 ++++----
9 files changed, 34 insertions(+), 34 deletions(-)
rename database/seeders/{DemoBillingDatabaseSeeder.php => ShowcaseBillingDatabaseSeeder.php} (90%)
rename database/seeders/{DemoCustomerSeeder.php => ShowcaseCustomerSeeder.php} (97%)
rename database/seeders/{DemoProductSeeder.php => ShowcaseProductSeeder.php} (98%)
rename database/seeders/{DemoSubscriptionSeeder.php => ShowcaseSubscriptionSeeder.php} (97%)
rename tests/Feature/{DemoSeederTest.php => ShowcaseSeederTest.php} (79%)
rename tests/Feature/{DemoStaffTest.php => ShowcaseStaffTest.php} (79%)
diff --git a/README.md b/README.md
index 2fc326c..28baccb 100644
--- a/README.md
+++ b/README.md
@@ -170,7 +170,7 @@ Run `npm run build` afterwards.
## Demo data
```bash
-php artisan modules:seed --module=billing --demo
+php artisan modules:seed --module=billing --state=showcase
```
Adds sample plans (pushed to Stripe when your keys are set), sample customers, and a staff account (`billing@saucebase.dev`) that only sees billing in the admin. All use the `DEMO_PASSWORD` from `.env`.
diff --git a/Taskfile.yml b/Taskfile.yml
index c0d9532..f34f43e 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -21,9 +21,9 @@ tasks:
# ── Database ──────────────────────────────────────────────────
- db:seed:demo:
+ db:seed:showcase:
desc: Seed the Billing module with sample customers, subscriptions and payments
- cmd: '{{.APP}} php artisan modules:seed --module=billing --demo'
+ cmd: '{{.APP}} php artisan modules:seed --module=billing --state=showcase'
# ── Code Generation ────────────────────────────────────────────
diff --git a/database/seeders/DemoBillingDatabaseSeeder.php b/database/seeders/ShowcaseBillingDatabaseSeeder.php
similarity index 90%
rename from database/seeders/DemoBillingDatabaseSeeder.php
rename to database/seeders/ShowcaseBillingDatabaseSeeder.php
index 742f1ef..f96a56f 100644
--- a/database/seeders/DemoBillingDatabaseSeeder.php
+++ b/database/seeders/ShowcaseBillingDatabaseSeeder.php
@@ -10,13 +10,13 @@
use Spatie\Permission\Models\Role;
/**
- * Sample billing content for the demo site, run by `modules:seed --demo`.
+ * Sample billing content for the demo site, run by `modules:seed --state=showcase`.
*
* None of it is install data: a real app defines its own plans. The plans are
* created locally and pushed to the provider when its keys are present, which
* is what makes the demo site's checkout work.
*/
-class DemoBillingDatabaseSeeder extends Seeder
+class ShowcaseBillingDatabaseSeeder extends Seeder
{
public function run(): void
{
@@ -29,9 +29,9 @@ public function run(): void
$staff->syncRoles('billing admin');
$this->call([
- DemoProductSeeder::class,
- DemoCustomerSeeder::class,
- DemoSubscriptionSeeder::class,
+ ShowcaseProductSeeder::class,
+ ShowcaseCustomerSeeder::class,
+ ShowcaseSubscriptionSeeder::class,
]);
$this->pushToProvider();
@@ -70,7 +70,7 @@ private function pushToProvider(): void
$prices = 0;
try {
- foreach (Product::whereIn('slug', DemoProductSeeder::SLUGS)->get() as $product) {
+ foreach (Product::whereIn('slug', ShowcaseProductSeeder::SLUGS)->get() as $product) {
$report = $push->run($product);
$products += $report->products;
$prices += $report->prices;
diff --git a/database/seeders/DemoCustomerSeeder.php b/database/seeders/ShowcaseCustomerSeeder.php
similarity index 97%
rename from database/seeders/DemoCustomerSeeder.php
rename to database/seeders/ShowcaseCustomerSeeder.php
index 5ebeb1d..ce9b690 100644
--- a/database/seeders/DemoCustomerSeeder.php
+++ b/database/seeders/ShowcaseCustomerSeeder.php
@@ -17,9 +17,9 @@
*
* Signup dates run back over the last year on a rising curve, which is what gives
* the revenue and subscription charts a shape worth looking at. They are laid out
- * here, in one place, because DemoSubscriptionSeeder bills from them.
+ * here, in one place, because ShowcaseSubscriptionSeeder bills from them.
*/
-class DemoCustomerSeeder extends Seeder
+class ShowcaseCustomerSeeder extends Seeder
{
/**
* How many customers signed up each month, oldest month first. Twelve entries,
diff --git a/database/seeders/DemoProductSeeder.php b/database/seeders/ShowcaseProductSeeder.php
similarity index 98%
rename from database/seeders/DemoProductSeeder.php
rename to database/seeders/ShowcaseProductSeeder.php
index 3440cdf..d61172c 100644
--- a/database/seeders/DemoProductSeeder.php
+++ b/database/seeders/ShowcaseProductSeeder.php
@@ -16,12 +16,12 @@
*
* They carry no provider IDs: claiming an ID we do not own would make the push
* skip them and checkout fail against a price Stripe has never heard of.
- * `DemoBillingDatabaseSeeder` pushes them once every seeder has run.
+ * `ShowcaseBillingDatabaseSeeder` pushes them once every seeder has run.
*
* A real app defines its own products, which is why these are demo content
* rather than install data.
*/
-class DemoProductSeeder extends Seeder
+class ShowcaseProductSeeder extends Seeder
{
/** The plans this seeder owns, and the only ones the demo may push. */
public const SLUGS = ['free', 'pro', 'team', 'lifetime', 'enterprise'];
diff --git a/database/seeders/DemoSubscriptionSeeder.php b/database/seeders/ShowcaseSubscriptionSeeder.php
similarity index 97%
rename from database/seeders/DemoSubscriptionSeeder.php
rename to database/seeders/ShowcaseSubscriptionSeeder.php
index 4c2e83a..80c8e85 100644
--- a/database/seeders/DemoSubscriptionSeeder.php
+++ b/database/seeders/ShowcaseSubscriptionSeeder.php
@@ -25,10 +25,10 @@
* enough abandoned checkouts to keep the conversion rate short of a suspicious
* 100%.
*
- * Runs after DemoCustomerSeeder and DemoProductSeeder, and does nothing without
+ * Runs after ShowcaseCustomerSeeder and ShowcaseProductSeeder, and does nothing without
* them.
*/
-class DemoSubscriptionSeeder extends Seeder
+class ShowcaseSubscriptionSeeder extends Seeder
{
/** Every seventeenth of those behind on payment ran out of time entirely. */
private const SUSPENDED_EVERY = 17;
@@ -68,7 +68,7 @@ public function run(): void
/**
* The paid plans, cheapest first. Looked up by plan and interval rather than by
- * Stripe price ID, so the demo account's IDs live only in DemoProductSeeder.
+ * Stripe price ID, so the demo account's IDs live only in ShowcaseProductSeeder.
*
* @return list
*/
diff --git a/resources/boost/skills/saucebase-billing-development/SKILL.md b/resources/boost/skills/saucebase-billing-development/SKILL.md
index 2ce99ba..7cc9c5b 100644
--- a/resources/boost/skills/saucebase-billing-development/SKILL.md
+++ b/resources/boost/skills/saucebase-billing-development/SKILL.md
@@ -181,21 +181,21 @@ Everything else the merchant decides — provider, currency, checkout redirect,
The install seeder, `DatabaseSeeder`, only creates the `manage billing` permission (granted to nobody), which every billing admin page and resource checks in `canAccess()` (Customers, Products, Subscriptions, the Billing dashboard and Billing settings) and every billing widget in `canView()`, since the stats widget also sits on the main dashboard. `access admin panel` alone only opens the panel; `admin` passes every check. Plans are not seeded: a real install defines its own in the admin panel.
-Everything else the module seeds is demo content, run by `modules:seed --demo` through `DemoBillingDatabaseSeeder`, which calls one `Demo*Seeder` per kind of content, in dependency order:
+Everything else the module seeds is demo content, run by `modules:seed --state=showcase` through `ShowcaseBillingDatabaseSeeder`, which calls one `Demo*Seeder` per kind of content, in dependency order:
| Seeder | What it makes |
| --- | --- |
-| `DemoProductSeeder` | Five plans for a made-up developer tool, each with a kind and entitlements — Free, Pro (highlighted), Team, Lifetime (replaces Pro) and Enterprise (no price, `cta_url` to sales) — chosen so the pricing page shows every option it reads. No provider IDs. A real install defines its own. |
-| `DemoCustomerSeeder` | 48 users, customers and cards, signing up on a rising curve over the last twelve months. |
-| `DemoSubscriptionSeeder` | A subscription per customer, one payment and invoice per billing period since signup, plus abandoned checkouts. |
+| `ShowcaseProductSeeder` | Five plans for a made-up developer tool, each with a kind and entitlements — Free, Pro (highlighted), Team, Lifetime (replaces Pro) and Enterprise (no price, `cta_url` to sales) — chosen so the pricing page shows every option it reads. No provider IDs. A real install defines its own. |
+| `ShowcaseCustomerSeeder` | 48 users, customers and cards, signing up on a rising curve over the last twelve months. |
+| `ShowcaseSubscriptionSeeder` | A subscription per customer, one payment and invoice per billing period since signup, plus abandoned checkouts. |
Keep the `Demo` prefix on each: it is what marks the data as the demo site's rather than an install's.
-`DemoBillingDatabaseSeeder` runs `CatalogPush` after the three, and it is the only step that leaves the database. The seeded plans have no provider IDs, and a plan the provider does not know is not `purchasable()` — so without this every paid plan on the demo's pricing page says *Not available*. It is skipped under `runningUnitTests()` (the suite boots with the developer's own `.env`) and when the provider has no keys, and a provider that is unreachable warns rather than failing the seed. Put it here rather than inside `DemoProductSeeder`: the runner draws a task line around each seeder and swallows its output.
+`ShowcaseBillingDatabaseSeeder` runs `CatalogPush` after the three, and it is the only step that leaves the database. The seeded plans have no provider IDs, and a plan the provider does not know is not `purchasable()` — so without this every paid plan on the demo's pricing page says *Not available*. It is skipped under `runningUnitTests()` (the suite boots with the developer's own `.env`) and when the provider has no keys, and a provider that is unreachable warns rather than failing the seed. Put it here rather than inside `ShowcaseProductSeeder`: the runner draws a task line around each seeder and swallows its output.
-Two properties hold the demo data together, and a new seeder should keep both. It is **deterministic** — the customer names come from a fixed faker seed, and everything else from the customer's index — and it is **idempotent**, keyed on slugs, users and `*_demo_*` IDs, so reseeding updates rather than duplicates. Customers carry no provider ID: checkout creates a real one the first time a demo account buys. `DemoSeederTest` covers the second.
+Two properties hold the demo data together, and a new seeder should keep both. It is **deterministic** — the customer names come from a fixed faker seed, and everything else from the customer's index — and it is **idempotent**, keyed on slugs, users and `*_demo_*` IDs, so reseeding updates rather than duplicates. Customers carry no provider ID: checkout creates a real one the first time a demo account buys. `ShowcaseSeederTest` covers the second.
-Signup dates drive the whole dashboard: `DemoCustomerSeeder::SIGNUPS_PER_MONTH` is the growth curve the revenue and subscription charts draw, and `DemoSubscriptionSeeder` bills forward from each signup date to today.
+Signup dates drive the whole dashboard: `ShowcaseCustomerSeeder::SIGNUPS_PER_MONTH` is the growth curve the revenue and subscription charts draw, and `ShowcaseSubscriptionSeeder` bills forward from each signup date to today.
Nothing in the test suites depends on the demo plans. `BillingTestHelper::createSubscriberFixtures()` creates the "Pro" product and its price itself, which is what the e2e specs assert against.
diff --git a/tests/Feature/DemoSeederTest.php b/tests/Feature/ShowcaseSeederTest.php
similarity index 79%
rename from tests/Feature/DemoSeederTest.php
rename to tests/Feature/ShowcaseSeederTest.php
index 1066274..42876dd 100644
--- a/tests/Feature/DemoSeederTest.php
+++ b/tests/Feature/ShowcaseSeederTest.php
@@ -4,8 +4,8 @@
use Illuminate\Foundation\Testing\RefreshDatabase;
use Modules\Billing\Database\Seeders\DatabaseSeeder;
-use Modules\Billing\Database\Seeders\DemoBillingDatabaseSeeder;
-use Modules\Billing\Database\Seeders\DemoProductSeeder;
+use Modules\Billing\Database\Seeders\ShowcaseBillingDatabaseSeeder;
+use Modules\Billing\Database\Seeders\ShowcaseProductSeeder;
use Modules\Billing\Enums\SubscriptionStatus;
use Modules\Billing\Models\Customer;
use Modules\Billing\Models\Invoice;
@@ -14,7 +14,7 @@
use Modules\Billing\Models\Subscription;
use Tests\TestCase;
-class DemoSeederTest extends TestCase
+class ShowcaseSeederTest extends TestCase
{
use RefreshDatabase;
@@ -24,7 +24,7 @@ class DemoSeederTest extends TestCase
*/
public function test_the_demo_seeder_fills_every_dashboard_widget(): void
{
- $this->seed([DatabaseSeeder::class, DemoBillingDatabaseSeeder::class]);
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
$this->assertGreaterThan(0, Customer::count());
$this->assertGreaterThan(0, Payment::count());
@@ -36,10 +36,10 @@ public function test_the_demo_seeder_fills_every_dashboard_widget(): void
/** Re-running the demo seeder must not double the data. */
public function test_seeding_twice_leaves_the_same_data(): void
{
- $this->seed([DatabaseSeeder::class, DemoBillingDatabaseSeeder::class]);
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
$first = [Customer::count(), Subscription::count(), Payment::count()];
- $this->seed([DatabaseSeeder::class, DemoBillingDatabaseSeeder::class]);
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
$this->assertSame($first, [Customer::count(), Subscription::count(), Payment::count()]);
}
@@ -47,7 +47,7 @@ public function test_seeding_twice_leaves_the_same_data(): void
/** Pro's trial shows the feature: fewer API requests, no custom domains. */
public function test_the_pro_trial_is_narrower_than_pro(): void
{
- $this->seed(DemoProductSeeder::class);
+ $this->seed(ShowcaseProductSeeder::class);
$trial = Product::where('slug', 'pro')->sole()->entitlements(trial: true);
diff --git a/tests/Feature/DemoStaffTest.php b/tests/Feature/ShowcaseStaffTest.php
similarity index 79%
rename from tests/Feature/DemoStaffTest.php
rename to tests/Feature/ShowcaseStaffTest.php
index 4f04b7c..79334e0 100644
--- a/tests/Feature/DemoStaffTest.php
+++ b/tests/Feature/ShowcaseStaffTest.php
@@ -6,20 +6,20 @@
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
use Modules\Billing\Database\Seeders\DatabaseSeeder;
-use Modules\Billing\Database\Seeders\DemoBillingDatabaseSeeder;
+use Modules\Billing\Database\Seeders\ShowcaseBillingDatabaseSeeder;
use Tests\TestCase;
/**
* The demo ships a staff account for this module's admin area, so visitors can try a
* role that sees only part of the panel.
*/
-class DemoStaffTest extends TestCase
+class ShowcaseStaffTest extends TestCase
{
use RefreshDatabase;
public function test_the_demo_adds_a_staff_account_for_this_module_only(): void
{
- $this->seed([DatabaseSeeder::class, DemoBillingDatabaseSeeder::class]);
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
$staff = User::where('email', 'billing@saucebase.dev')->firstOrFail();
@@ -31,7 +31,7 @@ public function test_demo_accounts_use_the_configured_demo_password(): void
{
config(['saucebase.demo_password' => 'not-the-old-default']);
- $this->seed([DatabaseSeeder::class, DemoBillingDatabaseSeeder::class]);
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
$this->assertTrue(Hash::check('not-the-old-default', User::where('email', 'billing@saucebase.dev')->value('password')));
}
From bcd1eef61cc330d22140b8fd780bb56f19faedc0 Mon Sep 17 00:00:00 2001
From: roble
Date: Tue, 10 Nov 2026 16:51:08 +0000
Subject: [PATCH 5/9] docs: billing skill names the Showcase seeders
Co-Authored-By: Claude Opus 5.5
---
resources/boost/skills/saucebase-billing-development/SKILL.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/boost/skills/saucebase-billing-development/SKILL.md b/resources/boost/skills/saucebase-billing-development/SKILL.md
index 7cc9c5b..a4945ae 100644
--- a/resources/boost/skills/saucebase-billing-development/SKILL.md
+++ b/resources/boost/skills/saucebase-billing-development/SKILL.md
@@ -181,7 +181,7 @@ Everything else the merchant decides — provider, currency, checkout redirect,
The install seeder, `DatabaseSeeder`, only creates the `manage billing` permission (granted to nobody), which every billing admin page and resource checks in `canAccess()` (Customers, Products, Subscriptions, the Billing dashboard and Billing settings) and every billing widget in `canView()`, since the stats widget also sits on the main dashboard. `access admin panel` alone only opens the panel; `admin` passes every check. Plans are not seeded: a real install defines its own in the admin panel.
-Everything else the module seeds is demo content, run by `modules:seed --state=showcase` through `ShowcaseBillingDatabaseSeeder`, which calls one `Demo*Seeder` per kind of content, in dependency order:
+Everything else the module seeds is demo content, run by `modules:seed --state=showcase` through `ShowcaseBillingDatabaseSeeder`, which calls one `Showcase*Seeder` per kind of content, in dependency order:
| Seeder | What it makes |
| --- | --- |
@@ -189,7 +189,7 @@ Everything else the module seeds is demo content, run by `modules:seed --state=s
| `ShowcaseCustomerSeeder` | 48 users, customers and cards, signing up on a rising curve over the last twelve months. |
| `ShowcaseSubscriptionSeeder` | A subscription per customer, one payment and invoice per billing period since signup, plus abandoned checkouts. |
-Keep the `Demo` prefix on each: it is what marks the data as the demo site's rather than an install's.
+Keep the `Showcase` prefix on each: it marks the data as the showcase state's rather than an install's.
`ShowcaseBillingDatabaseSeeder` runs `CatalogPush` after the three, and it is the only step that leaves the database. The seeded plans have no provider IDs, and a plan the provider does not know is not `purchasable()` — so without this every paid plan on the demo's pricing page says *Not available*. It is skipped under `runningUnitTests()` (the suite boots with the developer's own `.env`) and when the provider has no keys, and a provider that is unreachable warns rather than failing the seed. Put it here rather than inside `ShowcaseProductSeeder`: the runner draws a task line around each seeder and swallows its output.
From a2b6abd6bb98524b5797e23f8e2d1ef2b8ededd8 Mon Sep 17 00:00:00 2001
From: roble
Date: Tue, 10 Nov 2026 20:40:49 +0000
Subject: [PATCH 6/9] chore: alias the dev branch as 3.5.x-dev
Co-Authored-By: Claude Opus 5.5
---
composer.json | 3 +++
1 file changed, 3 insertions(+)
diff --git a/composer.json b/composer.json
index 57261dd..bbd38de 100644
--- a/composer.json
+++ b/composer.json
@@ -27,6 +27,9 @@
"vue",
"react"
]
+ },
+ "branch-alias": {
+ "dev-dev": "3.5.x-dev"
}
},
"autoload": {
From 72bf05bf3b39bfd828743a8f39b1a537248d5b66 Mon Sep 17 00:00:00 2001
From: roble
Date: Sat, 14 Nov 2026 11:13:33 +0000
Subject: [PATCH 7/9] fix: pricing copy that fits any product
The plans page heading and intro were the starter kit's own marketing.
They now read as any product's pricing page.
Co-Authored-By: Claude Opus 5.5
---
resources/js/react/pages/Plans.tsx | 4 ++--
resources/js/vue/pages/Plans.vue | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/resources/js/react/pages/Plans.tsx b/resources/js/react/pages/Plans.tsx
index 0841eb8..e28222b 100644
--- a/resources/js/react/pages/Plans.tsx
+++ b/resources/js/react/pages/Plans.tsx
@@ -20,11 +20,11 @@ export default function Plans({
>
- {t('Pricing that ships with your app')}
+ {t('Choose your plan')}
{t(
- "Every plan here runs on the Billing module against Stripe's sandbox. Try the checkout: you won't be charged.",
+ 'Start free and upgrade when you need more. Cancel anytime.',
)}
diff --git a/resources/js/vue/pages/Plans.vue b/resources/js/vue/pages/Plans.vue
index ecfef78..ba3704e 100644
--- a/resources/js/vue/pages/Plans.vue
+++ b/resources/js/vue/pages/Plans.vue
@@ -18,12 +18,12 @@ defineProps();
- {{ $t('Pricing that ships with your app') }}
+ {{ $t('Choose your plan') }}
{{
$t(
- "Every plan here runs on the Billing module against Stripe's sandbox. Try the checkout: you won't be charged.",
+ 'Start free and upgrade when you need more. Cancel anytime.',
)
}}
From df21a0ad45463847879524e2483db0e1ebeead24 Mon Sep 17 00:00:00 2001
From: roble
Date: Sat, 14 Nov 2026 14:29:22 +0000
Subject: [PATCH 8/9] fix: the showcase keeps a free plan the app already has
Co-Authored-By: Claude Opus 5.5
---
database/seeders/ShowcaseProductSeeder.php | 5 +++++
tests/Feature/ShowcaseSeederTest.php | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/database/seeders/ShowcaseProductSeeder.php b/database/seeders/ShowcaseProductSeeder.php
index d61172c..25a8a22 100644
--- a/database/seeders/ShowcaseProductSeeder.php
+++ b/database/seeders/ShowcaseProductSeeder.php
@@ -35,6 +35,11 @@ class ShowcaseProductSeeder extends Seeder
public function run(): void
{
foreach ($this->plans() as $order => $plan) {
+ // An app has one free plan. One it already has (a template's own) stays.
+ if ($plan['kind'] === PlanKind::Free && Product::where('kind', PlanKind::Free)->where('slug', '!=', $plan['slug'])->exists()) {
+ continue;
+ }
+
$product = Product::updateOrCreate(
['slug' => $plan['slug']],
[
diff --git a/tests/Feature/ShowcaseSeederTest.php b/tests/Feature/ShowcaseSeederTest.php
index 42876dd..2750db7 100644
--- a/tests/Feature/ShowcaseSeederTest.php
+++ b/tests/Feature/ShowcaseSeederTest.php
@@ -6,6 +6,7 @@
use Modules\Billing\Database\Seeders\DatabaseSeeder;
use Modules\Billing\Database\Seeders\ShowcaseBillingDatabaseSeeder;
use Modules\Billing\Database\Seeders\ShowcaseProductSeeder;
+use Modules\Billing\Enums\PlanKind;
use Modules\Billing\Enums\SubscriptionStatus;
use Modules\Billing\Models\Customer;
use Modules\Billing\Models\Invoice;
@@ -33,6 +34,17 @@ public function test_the_demo_seeder_fills_every_dashboard_widget(): void
$this->assertGreaterThan(0, Subscription::where('status', SubscriptionStatus::Cancelled)->count());
}
+ /** An app has one free plan: a template's own stays, and the showcase adds the rest. */
+ public function test_the_showcase_keeps_a_free_plan_the_app_already_has(): void
+ {
+ $ownFree = Product::factory()->create(['slug' => 'uptime-free', 'kind' => PlanKind::Free]);
+
+ $this->seed([DatabaseSeeder::class, ShowcaseBillingDatabaseSeeder::class]);
+
+ $this->assertSame([$ownFree->id], Product::where('kind', PlanKind::Free)->pluck('id')->all());
+ $this->assertTrue(Product::where('slug', 'pro')->exists());
+ }
+
/** Re-running the demo seeder must not double the data. */
public function test_seeding_twice_leaves_the_same_data(): void
{
From 0f104729a0e42faf253c5f9c0f3aa92299518700 Mon Sep 17 00:00:00 2001
From: roble
Date: Sun, 15 Nov 2026 18:55:38 +0000
Subject: [PATCH 9/9] chore: require saucebase/core ^3.0
Co-Authored-By: Claude Opus 5.5
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index bbd38de..b830dcd 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,7 @@
}
],
"require": {
- "saucebase/core": "^2.12.0",
+ "saucebase/core": "^3.0",
"stripe/stripe-php": "^22.0"
},
"license": "MIT",
|