Skip to content

Add thin (v2) event support to Stripe hosting integration (#1465)#1466

Open
normandev92 wants to merge 3 commits into
CommunityToolkit:mainfrom
normandev92:stripe-thin-events
Open

Add thin (v2) event support to Stripe hosting integration (#1465)#1466
normandev92 wants to merge 3 commits into
CommunityToolkit:mainfrom
normandev92:stripe-thin-events

Conversation

@normandev92

Copy link
Copy Markdown

Closes #1465

Adds thin (v2) event support to the CommunityToolkit.Aspire.Hosting.Stripe integration. The Stripe CLI forwards Stripe's v2 event family separately from snapshot events via --forward-thin-to / --thin-events; this PR exposes those through new WithThinListen overloads mirroring the existing WithListen surface (both IResourceBuilder<IResourceWithEndpoints> and IResourceBuilder<ExternalServiceResource> targets).

var stripe = builder.AddStripe("stripe", stripeApiKey)
    .WithListen(api, webhookPath: "/webhooks/stripe",
                events: ["charge.dispute.created"])
    .WithThinListen(api, webhookPath: "/webhooks/stripe/thin",
                thinEvents: ["v2.core.account[configuration.recipient].capability_status_updated"]);

Motivating use case: Connect platforms using Accounts v2, where payout activation is signalled by v2.core.account[configuration.recipient].capability_status_updated — a thin-only event — while classic events (e.g. charge.dispute.created) remain snapshot. Details in the linked issue.

Implementation notes:

  • The listen command argument is now added exactly once per resource (annotation-guarded EnsureListenCommand), so WithListen and WithThinListen compose into a single CLI session: listen --forward-to … --events … --forward-thin-to … --thin-events ….
  • ResolveSecret is likewise guarded: the CLI emits one signing secret per session covering both families, so a single log watcher suffices and the existing WithReference(stripe, …) signing-secret plumbing works unchanged.
  • API baseline regenerated via -t:GenAPIGenerateReferenceAssemblySource; integration README documents the new API.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

  • 7 new tests in AddStripeTests: thin args, thin event filtering, combined snapshot+thin single-session argument order, endpoint-reference target, and null-argument guards. The two pre-existing AppHostTests integration tests require a real Parameters:stripe-api-key and fail identically on main in my environment — unrelated to this change.
  • The linked issue Stripe hosting integration: support thin (v2) events — --thin-events / --forward-thin-to #1465 was filed just ahead of this PR; happy to adjust the API shape (naming, defaults) per maintainer preference.
  • "Allow edits by maintainers" is enabled.

Copilot AI review requested due to automatic review settings July 10, 2026 15:59
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1466

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1466"

Copilot AI left a comment

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.

Pull request overview

Adds thin (Stripe v2) event forwarding support to the CommunityToolkit.Aspire.Hosting.Stripe integration by introducing WithThinListen overloads that compose with existing WithListen configuration so both snapshot and thin event families can share a single stripe listen session (and signing secret).

Changes:

  • Added WithThinListen(...) overloads (for both IResourceWithEndpoints and ExternalServiceResource) and guarded listen command / secret-watcher setup for composability.
  • Added unit tests validating thin forwarding args, thin event filtering, and combined snapshot+thin argument ordering.
  • Updated README usage guidance and regenerated the public API baseline.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
tests/CommunityToolkit.Aspire.Hosting.Stripe.Tests/AddStripeTests.cs Adds new unit tests for thin listen behavior and null guards.
src/CommunityToolkit.Aspire.Hosting.Stripe/StripeExtensions.cs Introduces WithThinListen APIs and composes listen/secret behavior across snapshot+thin modes.
src/CommunityToolkit.Aspire.Hosting.Stripe/README.md Documents how to configure thin (v2) event forwarding and combined usage.
src/CommunityToolkit.Aspire.Hosting.Stripe/api/CommunityToolkit.Aspire.Hosting.Stripe.cs Updates generated API baseline to include new exported methods.

Comment thread tests/CommunityToolkit.Aspire.Hosting.Stripe.Tests/AddStripeTests.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/StripeExtensions.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/README.md Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/StripeExtensions.cs
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/StripeExtensions.cs Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/StripeExtensions.cs
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/README.md Outdated
Comment thread src/CommunityToolkit.Aspire.Hosting.Stripe/README.md
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.

Stripe hosting integration: support thin (v2) events — --thin-events / --forward-thin-to

2 participants