Skip to content

Remove Stripe pricing table integration#479

Open
bonus414 wants to merge 3 commits into
devfrom
fix/remove-stripe-pricing-table
Open

Remove Stripe pricing table integration#479
bonus414 wants to merge 3 commits into
devfrom
fix/remove-stripe-pricing-table

Conversation

@bonus414
Copy link
Copy Markdown
Collaborator

@bonus414 bonus414 commented May 8, 2026

What

The pricing dashboard is being retired. Self-serve onboarding will move to my.amazee.io. This removes the entire Stripe pricing table integration — UI, API, and supporting code.

Removed (16 files, -1,762 lines)

Frontend

  • /upgrade page — the email-linked pricing page with JWT token auth
  • /team-admin/pricing page — logged-in team admin pricing view
  • Admin pricing table components (dialog + list) from /admin/products
  • use-upgrade store + tests
  • pricing-table types
  • Sidebar "Pricing" link
  • /upgrade from public paths in middleware

Backend

  • app/api/pricing_tables.py — full CRUD API for pricing table records
  • GET /billing/teams/{id}/pricing-table-session endpoint
  • get_pricing_table_secret() from stripe service
  • PricingTableSession, PricingTableCreate, PricingTableResponse, PricingTablesResponse schemas
  • Pricing table migration call from initialise_resources.py

Kept for engineering to decide on

  • DBPricingTable model + DB migration — the pricing_tables table still exists in the DB. Dropping it needs a proper Alembic migration. Leaving for you to decide timing.
  • scripts/migrate_pricing_tables.py — dead script, no longer called from init. Can be deleted alongside the DB table drop.
  • generate_pricing_url() — still used by the always-free email and the auth re-validation flow (returning-user-url). Separate concern.

Also: deactivate the pricing table in Stripe Dashboard

This has already been completed

Related

The pricing dashboard is being retired — self-serve onboarding will
move to my.amazee.io. This removes all pricing table UI, API endpoints,
and supporting code.

Removed:
- Frontend: /upgrade page, /team-admin/pricing page, pricing table
  admin components (dialog + list), use-upgrade store + tests,
  pricing-table types
- Backend: /pricing-tables API (pricing_tables.py), pricing-table-session
  endpoint from billing, get_pricing_table_secret from stripe service,
  PricingTable* schemas
- Infra: pricing table migration call from initialise_resources.py
- Sidebar 'Pricing' link, /upgrade public path in middleware

Kept (for engineering to decide on separately):
- DBPricingTable model + migration (needs a proper migration to drop)
- scripts/migrate_pricing_tables.py (dead, no longer called)
- generate_pricing_url() — still used by always-free email and auth
  re-validation flow
@bonus414 bonus414 requested review from dan2k3k4, dspachos and pmelab May 8, 2026 20:45
@dspachos
Copy link
Copy Markdown
Contributor

dspachos commented May 9, 2026

❌ Critical Issues (Blocking Merge)

The PR is currently failing the Tests/backend-tests CI check with 31 failures. This is because the backend tests were not updated to reflect the removal of the pricing table logic:

  • tests/test_pricing_tables.py: This entire file needs to be deleted as it tests the now-deleted app/api/pricing_tables.py router.
  • tests/test_billing.py: Several test cases (e.g., test_get_pricing_table_session_*) still target the removed /pricing-table-session endpoint and must be deleted or updated.

⚠️ Recommendations for Cleanup

  • Delete scripts/migrate_pricing_tables.py: The PR description identifies this as a "dead script" and the call to it has already been removed from initialise_resources.py. It's best to delete it now to avoid keeping orphaned code.
  • Database Model: The DBPricingTable model remains in app/db/models.py. If the pricing tables are being fully retired, I recommend removing this model and adding an Alembic migration to drop the table, rather than leaving it for a future task.

@bonus414 want me to fix these?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the retired Stripe Pricing Table–based pricing dashboard across frontend and backend, including UI pages/components, API endpoints, schemas, and initialization hooks.

Changes:

  • Frontend: delete /upgrade and /team-admin/pricing pages plus admin pricing-table management UI/state/types.
  • Backend: delete pricing tables CRUD API and the /billing/teams/{id}/pricing-table-session endpoint, along with associated Stripe helper + schemas.
  • Init script: stop running the historical pricing-table data migration during resource initialization.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/initialise_resources.py Removes pricing-table migration import and execution from initialization flow.
frontend/src/types/pricing-table.ts Deletes shared pricing-table type definitions.
frontend/src/stores/use-upgrade.ts Deletes Zustand store for tokenized /upgrade pricing flow.
frontend/src/stores/use-upgrade.test.ts Removes tests for the deleted use-upgrade store.
frontend/src/middleware.ts Removes /upgrade from public paths in Next.js middleware.
frontend/src/components/sidebar-layout.tsx Removes “Pricing” navigation entry and related /upgrade sidebar suppression.
frontend/src/app/upgrade/page.tsx Deletes token-auth pricing page that rendered Stripe pricing table.
frontend/src/app/team-admin/pricing/page.tsx Deletes team-admin pricing page that rendered Stripe pricing table.
frontend/src/app/admin/products/page.tsx Removes Pricing Tables tab and related queries/dialog wiring from admin products page.
frontend/src/app/admin/products/_components/pricing-tables-list.tsx Deletes admin pricing tables list component.
frontend/src/app/admin/products/_components/pricing-table-dialog.tsx Deletes admin pricing table create/update dialog component.
app/services/stripe.py Removes get_pricing_table_secret() Stripe customer-session helper.
app/schemas/models.py Removes pricing-table-related Pydantic schemas.
app/main.py Removes inclusion of the /pricing-tables router.
app/api/pricing_tables.py Deletes pricing tables CRUD API router.
app/api/billing.py Removes GET /billing/teams/{team_id}/pricing-table-session endpoint and related imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/middleware.ts Outdated
Comment thread app/main.py
Comment on lines 175 to 180
app.include_router(teams.router, prefix="/teams", tags=["teams"])
app.include_router(billing.router, prefix="/billing", tags=["billing"])
app.include_router(products.router, prefix="/products", tags=["products"])
app.include_router(
pricing_tables.router, prefix="/pricing-tables", tags=["pricing-tables"]
)
app.include_router(limits.router, prefix="/limits", tags=["limits"])
app.include_router(budgets.router, prefix="/budgets", tags=["budgets"])
app.include_router(spend.router, prefix="/spend", tags=["spend"])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already implemented in commit 45f20c4: deleted tests/test_pricing_tables.py entirely (777 lines) which tested the removed /pricing-tables router.

Comment thread app/api/billing.py
Comment on lines 160 to 164


@router.get(
"/teams/{team_id}/pricing-table-session",
dependencies=[Depends(get_role_min_specific_team_admin)],
response_model=PricingTableSession,
)
async def get_pricing_table_session(team_id: int, db: Session = Depends(get_db)):
"""
Create a Stripe Customer Session client secret for team subscription management.
If the team doesn't have a Stripe customer ID, one will be created first.

Args:
team_id: The ID of the team to create the customer session for

Returns:
JSON response containing the client secret
"""
# Get the team
team = db.query(DBTeam).filter(DBTeam.id == team_id).first()
if not team:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Team not found"
)

try:
# Create Stripe customer if one doesn't exist
if not team.stripe_customer_id:
logger.info(f"Creating Stripe customer for team {team.id}")
team.stripe_customer_id = await create_stripe_customer(team)
db.add(team)
db.commit()

logger.info(f"Stripe ID is {team.stripe_customer_id}")
# Create customer session using the service
client_secret = await get_pricing_table_secret(team.stripe_customer_id)

return PricingTableSession(client_secret=client_secret)
except Exception as e:
logger.error(f"Error creating customer session: {str(e)}")
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Error creating customer session",
)


@router.post(
"/teams/{team_id}/subscriptions",
dependencies=[Depends(get_role_min_system_admin)],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit 45f20c4: removed the obsolete /billing/teams/{id}/pricing-table-session tests from tests/test_billing.py and deleted tests/test_pricing_tables.py.

@bonus414
Copy link
Copy Markdown
Collaborator Author

@dspachos yes, go ahead. thank you!

dan2k3k4 and others added 2 commits May 11, 2026 15:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

❌ Critical Issues (Blocking Merge)

The PR is currently failing the Tests/backend-tests CI check with 31 failures. This is because the backend tests were not updated to reflect the removal...

Addressed in commit 45f20c4: deleted tests/test_pricing_tables.py, removed all test_get_pricing_table_session_* cases from tests/test_billing.py, and deleted scripts/migrate_pricing_tables.py.

Copy link
Copy Markdown
Contributor

@dspachos dspachos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should me merged to dev? (I see base branch is main now)

Base automatically changed from main to dev May 19, 2026 07:48
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.

5 participants