Skip to content
DocsTry Aspire
DocsTry

StripeExtensions Methods

ClassMethods5 members
Extension methods for adding Stripe CLI to a Hosting.IDistributedApplicationBuilder.
AddStripe(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>)Section titled AddStripe(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>)extensionIResourceBuilder<StripeResource>
Adds the Stripe CLI to the application model for local webhook forwarding.
public static class StripeExtensions
{
public static IResourceBuilder<StripeResource> AddStripe(
this IDistributedApplicationBuilder builder,
string name,
IResourceBuilder<ParameterResource> apiKey)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the resource.
apiKeyIResourceBuilder<ParameterResource>The parameter builder providing the Stripe API key.
IResourceBuilder<StripeResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithApiKey(IResourceBuilder<StripeResource>, IResourceBuilder<ParameterResource>)Section titled WithApiKey(IResourceBuilder<StripeResource>, IResourceBuilder<ParameterResource>)extensionIResourceBuilder<StripeResource>
Configures the Stripe CLI to use a specific API key from a parameter.
public static class StripeExtensions
{
public static IResourceBuilder<StripeResource> WithApiKey(
this IResourceBuilder<StripeResource> builder,
IResourceBuilder<ParameterResource> apiKey)
{
// ...
}
}
builderIResourceBuilder<StripeResource>The resource builder.
apiKeyIResourceBuilder<ParameterResource>The parameter containing the Stripe API key to use.
IResourceBuilder<StripeResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithListen(IResourceBuilder<StripeResource>, IResourceBuilder<IResourceWithEndpoints>, string, IEnumerable<string>)Section titled WithListen(IResourceBuilder<StripeResource>, IResourceBuilder<IResourceWithEndpoints>, string, IEnumerable<string>)extensionIResourceBuilder<StripeResource>
Configures the Stripe CLI to listen for webhooks and forward them to the specified URL expression.
public static class StripeExtensions
{
public static IResourceBuilder<StripeResource> WithListen(
this IResourceBuilder<StripeResource> builder,
IResourceBuilder<IResourceWithEndpoints> forwardTo,
string webhookPath = "/webhooks/stripe",
IEnumerable<string>? events = null)
{
// ...
}
}
builderIResourceBuilder<StripeResource>The resource builder.
forwardToIResourceBuilder<IResourceWithEndpoints>The resource to forward webhooks to.
webhookPathstringoptionalThe path to the webhook endpoint.
eventsIEnumerable<string>optionalOptional collection of specific webhook events to listen for (e.g., ["payment_intent.created", "charge.succeeded"]). If not specified, all events are forwarded.
IResourceBuilder<StripeResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithListen(IResourceBuilder<StripeResource>, IResourceBuilder<ExternalServiceResource>, string, IEnumerable<string>)Section titled WithListen(IResourceBuilder<StripeResource>, IResourceBuilder<ExternalServiceResource>, string, IEnumerable<string>)extensionIResourceBuilder<StripeResource>
Configures the Stripe CLI to listen for webhooks and forward them to the specified URL expression.
public static class StripeExtensions
{
public static IResourceBuilder<StripeResource> WithListen(
this IResourceBuilder<StripeResource> builder,
IResourceBuilder<ExternalServiceResource> forwardTo,
string webhookPath = "/webhooks/stripe",
IEnumerable<string>? events = null)
{
// ...
}
}
builderIResourceBuilder<StripeResource>The resource builder.
forwardToIResourceBuilder<ExternalServiceResource>The resource to forward webhooks to.
webhookPathstringoptionalThe path to the webhook endpoint.
eventsIEnumerable<string>optionalOptional collection of specific webhook events to listen for (e.g., ["payment_intent.created", "charge.succeeded"]). If not specified, all events are forwarded.
IResourceBuilder<StripeResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithReference(IResourceBuilder<TDestination>, IResourceBuilder<StripeResource>, string)Section titled WithReference(IResourceBuilder<TDestination>, IResourceBuilder<StripeResource>, string)extensionIResourceBuilder<TDestination>
Adds a reference to a Stripe CLI resource for accessing its webhook signing secret.
public static class StripeExtensions
{
public static IResourceBuilder<TDestination> WithReference<TDestination>(
this IResourceBuilder<TDestination> builder,
IResourceBuilder<StripeResource> source,
string webhookSigningSecretEnvVarName = "STRIPE_WEBHOOK_SECRET")
{
// ...
}
}
builderIResourceBuilder<TDestination>The resource builder.
sourceIResourceBuilder<StripeResource>The Stripe CLI resource to reference.
webhookSigningSecretEnvVarNamestringoptionalOptional environment variable name to use for the webhook signing secret. Defaults to "STRIPE_WEBHOOK_SECRET".
IResourceBuilder<TDestination>A reference to the ApplicationModel.IResourceBuilder`1.