Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Implements hosting integration for Stripe CLI to enable local webhook forwarding and testing in Aspire applications.

Changes

Integration (CommunityToolkit.Aspire.Hosting.Stripe)

  • StripeResource - ExecutableResource wrapping Stripe CLI
  • AddStripe() - Registers Stripe CLI resource (excluded from manifest)
  • WithListen() - Configures webhook forwarding with 3 overloads:
    • Static URL strings
    • Endpoint references
    • ReferenceExpressions for dynamic URL construction
  • WithApiKey() - Accepts direct strings or parameter resources
  • WithReference() - Injects webhook signing secret as environment variable (default: STRIPE_WEBHOOK_SECRET)
  • Event filtering via optional events parameter

Tests

  • 20 unit tests covering resource creation, argument configuration, and input validation
  • Integration tests via example AppHost
  • Added to CI workflow

Example

  • AppHost demonstrating webhook forwarding to API endpoint
  • Sample API with webhook handler accessing signing secret

Usage

var builder = DistributedApplication.CreateBuilder(args);

var stripe = builder.AddStripe("stripe")
    .WithListen("http://localhost:5082/payments/stripe-webhook", 
                events: "payment_intent.created,charge.succeeded");

var api = builder.AddProject<Projects.API>("api")
    .WithReference(stripe);  // Injects STRIPE_WEBHOOK_SECRET

builder.Build().Run();

Webhook signing secret accessible via IConfiguration["STRIPE_WEBHOOK_SECRET"] in referenced services.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • k4kvsblobprodcus344.vsblob.vsassets.io
    • Triggering command: dotnet build --no-restore (dns block)
    • Triggering command: dotnet restore (dns block)
    • Triggering command: dotnet workload restore (dns block)
  • lylvsblobprodcus31.vsblob.vsassets.io
    • Triggering command: dotnet build (dns block)
  • pc2vsblobprodcus360.vsblob.vsassets.io
    • Triggering command: dotnet build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Hosting integration for Stripe CLI</issue_title>
<issue_description>### Related to an existing integration?

No

Existing integration

No response

Overview

It would be a valuable addition to the Aspire ecosystem to include a built-in integration for the Stripe CLI. When working locally, the Stripe CLI is essential for simulating webhooks, managing test data, and interacting with the Stripe API in real time. Embedding this functionality into Aspire as a hosting extension would streamline the developer experience by reducing manual setup and enabling better orchestration of services. This could significantly improve productivity and consistency across environments, especially for teams building payment-enabled applications. A native Aspire extension for Stripe CLI would align well with Aspire’s goal of simplifying cloud-native development through composable and observable service models.

Usage example

var stripe = builder.AddStripeLocal("stripe")...

var api = builder.AddProject<Projects.API>("api")
                   .WithReference(stripe);

Extra: commands on the resource to trigger sample requests.

Breaking change?

I'm not sure

Alternatives

$ stripe listen --forward-to http://localhost:5082/payments/stripe-webhook

Additional context

There's an article that touches the topic by @julioct

https://juliocasal.com/blog/how-to-build-custom-net-aspire-hosting-extensions-with-stripe-cli-example
https://juliocasal.com/blog/speed-up-your-stripe-dev-loop-with-net-aspire

I could help implementing this solution but I wouldn't be able to deviate too much from the blog post.

Help us help you

No, just wanted to propose this</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Hosting Integration Creator
This agent helps users create new hosting integration in Aspire by scaffolding the correct projects and files based on user input.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 6, 2025 05:15
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title [WIP] Add hosting integration for Stripe CLI Add Stripe CLI hosting integration Nov 6, 2025
Copilot AI requested a review from aaronpowell November 6, 2025 05:26
Copilot finished work on behalf of aaronpowell November 6, 2025 05:26
@github-actions github-actions bot added the Stale label Nov 12, 2025
@aaronpowell aaronpowell removed the Stale label Nov 12, 2025
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.

Hosting integration for Stripe CLI

2 participants