Skip to content

feat: Next generation Stripe billing integration#2161

Open
niemyjski wants to merge 1 commit intomainfrom
feature/next-stripe
Open

feat: Next generation Stripe billing integration#2161
niemyjski wants to merge 1 commit intomainfrom
feature/next-stripe

Conversation

@niemyjski
Copy link
Member

Summary

  • Adds new Stripe billing components: ChangePlanDialog and StripeProvider
  • Implements Stripe Checkout session creation via API
  • Adds billing features to organization API: getBilling, changePlan, getInvoices
  • Updates billing pages to use new components
  • Updates organization and invoice mappers
  • Adds Stripe integration plan document

Changes

  • New Svelte components for Stripe integration
  • New backend endpoints for billing management
  • Updated usage pages to show billing info

- Upgrade Stripe.net to v50.4.1 and update the backend to support modern PaymentMethods while maintaining legacy token compatibility.
- Implement a new billing feature in the Svelte UI with lazy-loaded Stripe integration and a functional plan change dialog.
- Add TanStack Query hooks for fetching available plans and processing plan changes with coupon support.
Copilot AI review requested due to automatic review settings March 17, 2026 03:14
@niemyjski niemyjski force-pushed the feature/next-stripe branch from 985add7 to ee79cb9 Compare March 17, 2026 03:15
@niemyjski niemyjski self-assigned this Mar 17, 2026
Comment on lines +285 to +288
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to fetch price details for price ID: {PriceId}. Exception: {Message}", priceId, ex.Message);
}
Copy link
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

This PR introduces a “next generation” Stripe billing integration spanning backend Stripe.net v50 updates, new billing endpoints/DTO mapping, and a new Svelte 5 billing UI (Stripe provider + change-plan dialog) wired into organization/project usage and billing pages.

Changes:

  • Upgrades Stripe.net usage on the backend (invoice status handling, discounts, subscription updates, PaymentMethod support).
  • Adds a new Svelte billing feature module (StripeProvider, ChangePlanDialog) and hooks it into usage/billing routes.
  • Extends org client API with plan query + change-plan mutation; updates invoice mapping/tests accordingly.

Reviewed changes

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

Show a summary per file
File Description
tests/Exceptionless.Tests/Mapping/InvoiceMapperTests.cs Updates Stripe invoice test data to use Status instead of Paid.
tests/Exceptionless.Tests/Controllers/TokenControllerTests.cs Simplifies test comments (no functional change).
src/Exceptionless.Web/Mapping/InvoiceMapper.cs Maps “paid” via Invoice.Status string comparison.
src/Exceptionless.Web/Controllers/OrganizationController.cs Updates Stripe invoice retrieval/discount handling and modernizes change-plan flow to support PaymentMethods + Stripe.net 50 API changes.
src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/usage/+page.svelte “Change plan” now navigates to the org billing page.
src/Exceptionless.Web/ClientApp/src/routes/(app)/organization/[organizationId]/usage/+page.svelte “Change plan” now navigates to the org billing page.
src/Exceptionless.Web/ClientApp/src/routes/(app)/organization/[organizationId]/billing/+page.svelte Uses new billing module ChangePlanDialog and passes loaded org data into it.
src/Exceptionless.Web/ClientApp/src/lib/features/organizations/components/dialogs/change-plan-dialog.svelte Removes the legacy placeholder change-plan dialog component.
src/Exceptionless.Web/ClientApp/src/lib/features/organizations/api.svelte.ts Adds getPlansQuery() and changePlanMutation() + related query keys/types.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/stripe.svelte.ts Adds Stripe context + lazy singleton loader utilities.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/schemas.ts Adds zod schema/types for the change-plan form.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/models.ts Adds billing model re-exports + local billing form/params types.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/index.ts Barrel exports for billing feature module.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/constants.ts Defines FREE_PLAN_ID.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/components/stripe-provider.svelte Adds Stripe Elements provider wrapper with loading/error states.
src/Exceptionless.Web/ClientApp/src/lib/features/billing/components/change-plan-dialog.svelte Implements the plan change dialog UI including Stripe payment collection.
src/Exceptionless.Web/ClientApp/package.json Adds Stripe JS + svelte-stripe dependencies.
src/Exceptionless.Web/ClientApp/package-lock.json Locks Stripe JS + svelte-stripe dependencies.
src/Exceptionless.Web/ClientApp/STRIPE-INTEGRATION-PLAN.md Adds the Stripe integration plan document.
src/Exceptionless.Core/Exceptionless.Core.csproj Upgrades Stripe.net to 50.4.1.
.claude/agents/engineer.md Adds guidance for rerunning flaky CI jobs via gh run rerun.
Files not reviewed (1)
  • src/Exceptionless.Web/ClientApp/package-lock.json: Language not supported

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

Comment on lines +269 to +289
<!-- Stripe PaymentElement for new card -->
{#if needsPayment}
<StripeProvider
appearance={{
theme: 'stripe',
variables: {
borderRadius: '6px'
}
}}
onElementsChange={(elements) => {
stripeElements = elements;
}}
onload={(loadedStripe) => {
stripe = loadedStripe;
}}
>
<div class="rounded-lg border p-4">
<PaymentElement />
</div>
</StripeProvider>
{/if}
catch (Exception ex)
{
_logger.LogError(ex, "An error occurred while getting the invoice: {InvoiceId}", id);
_logger.LogError(ex, "An error occurred while getting the invoice: {InvoiceId}. Exception: {Message}", id, ex.Message);
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to fetch price details for price ID: {PriceId}. Exception: {Message}", priceId, ex.Message);
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
Exceptionless.Insulation 24% 23% 208
Exceptionless.Core 66% 60% 7546
Exceptionless.AppHost 26% 14% 55
Exceptionless.Web 57% 43% 3631
Summary 61% (11869 / 19433) 54% (5903 / 10994) 11440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants