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 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
@aaronpowell aaronpowell force-pushed the copilot/add-stripe-cli-integration branch from 7823d96 to d4abb78 Compare November 27, 2025 00:07
@aaronpowell
Copy link
Member

@Kralizek @julioct I've finally got back to this after the latest release. What do you think of the approach? It's using the installed executable not the container version, or do you think that would be a better option?

@Kralizek
Copy link

Is there a specific advantage on targeting the locally installed CLI rather than leveraging the existing container?

It feels like it's adding a manual step (installation of the CLI) that can be skipped altogether.

@julioct
Copy link

julioct commented Nov 27, 2025

@Kralizek @julioct I've finally got back to this after the latest release. What do you think of the approach? It's using the installed executable not the container version, or do you think that would be a better option?

Why not use the container? As with anything Aspire-related, the whole point is that anyone can clone the repo, hit F5, and it just works.

@aaronpowell
Copy link
Member

That's a fair point - I was trying to simplify getting the signing code, but it comes at a cost of simplicity. The branch has a rewrite that uses the container version.

@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 78% 40% 108
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 74% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 29% 7% 124
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 61% 34% 76
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Bun 96% 83% 28
CommunityToolkit.Aspire.Hosting.Dapr 60% 37% 840
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 44
CommunityToolkit.Aspire.Hosting.Flagd 79% 100% 32
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 88% 73% 36
CommunityToolkit.Aspire.Hosting.Golang 51% 40% 88
CommunityToolkit.Aspire.Hosting.Java 70% 75% 130
CommunityToolkit.Aspire.Hosting.JavaScript.Extensions 97% 85% 200
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 22
CommunityToolkit.Aspire.Hosting.KurrentDB 71% 75% 34
CommunityToolkit.Aspire.Hosting.LavinMQ 74% 50% 26
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 85% 50% 22
CommunityToolkit.Aspire.Hosting.McpInspector 75% 39% 154
CommunityToolkit.Aspire.Hosting.Meilisearch 71% 57% 58
CommunityToolkit.Aspire.Hosting.Minio 88% 75% 56
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 96% 83% 36
CommunityToolkit.Aspire.Hosting.MySql.Extensions 100% 88% 78
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.Ollama 65% 69% 260
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 78% 61% 77
CommunityToolkit.Aspire.Hosting.PapercutSmtp 81% 50% 18
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 45% 29% 100
CommunityToolkit.Aspire.Hosting.RavenDB 62% 48% 148
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.Solr 72% 100% 22
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 51% 48% 192
CommunityToolkit.Aspire.Hosting.Sqlite 89% 89% 52
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.Stripe 51% 30% 82
CommunityToolkit.Aspire.Hosting.SurrealDb 55% 40% 256
CommunityToolkit.Aspire.KurrentDB 94% 92% 54
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 61% 58% 114
CommunityToolkit.Aspire.Minio.Client 90% 85% 112
CommunityToolkit.Aspire.OllamaSharp 77% 71% 132
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 67% (7388 / 10978) 55% (2074 / 3750) 4766

Minimum allowed line rate is 60%

@aaronpowell aaronpowell deployed to azure-artifacts November 28, 2025 01:17 — with GitHub Actions Active
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

4 participants