Skip to content

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

Description

@normandev92

Overview

CommunityToolkit.Aspire.Hosting.Stripe's WithListen(...) maps to the Stripe CLI's snapshot-event flags (--events / --forward-to). The Stripe CLI also supports the v2 thin event family via separate flags:

stripe listen \
  --events charge.dispute.created \
  --forward-to https://localhost:7159/webhooks/stripe \
  --thin-events "v2.core.account[configuration.recipient].capability_status_updated" \
  --forward-thin-to https://localhost:7159/webhooks/stripe/thin

There is currently no way to express --thin-events / --forward-thin-to through the integration, so apps that consume v2 events can't use it and fall back to a raw AddContainer("stripe/stripe-cli") with hand-built args.

Why it matters

Thin events are not exotic: they are the only delivery mechanism for Stripe's v2 event family, which includes the Accounts v2 events used by Connect platforms — e.g. v2.core.account[configuration.recipient].capability_status_updated, the event that signals a connected account can receive transfers (payout activation). Any platform doing Connect onboarding with Accounts v2 needs a thin destination alongside its classic snapshot endpoint. Stripe requires the two families to be delivered separately (different endpoints in real deployments), which the CLI models with the separate flag pair.

Proposed API

Something in the spirit of the existing surface:

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"]);

Notes:

  • Both families can share one stripe listen session, so this is additive args on the same resource, not a second container.
  • The CLI signs both families with the same session signing secret, so the existing WithReference(stripe, webhookSigningSecretEnvVarName: ...) plumbing works unchanged.
  • A --skip-verify opt-in would also help when forwarding to local HTTPS endpoints with dev certificates, but that may deserve its own issue.

Workaround today

Raw container with explicit args:

builder.AddContainer("stripe-cli", "stripe/stripe-cli")
    .WithEnvironment("STRIPE_API_KEY", stripeApiKey)
    .WithArgs("listen", "--skip-verify",
        "--events", "charge.dispute.created",
        "--forward-to", snapshotUrlExpr,
        "--thin-events", "v2.core.account[configuration.recipient].capability_status_updated",
        "--forward-thin-to", thinUrlExpr);

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions