A modular, strongly-typed Blazor library for Stripe Elements β designed to provide first-class C# configuration and deep interop with Stripe.js. Built for modern Blazor projects using Stripe's Payment, Link Authentication, and Address Elements.
- π Blazor-native components for
<StripeElements>
,<StripePaymentElement>
,<StripeLinkAuthenticationElement>
, and<StripeAddressElement>
- π§ Fully configurable via C# β with strong typing for all supported options, including appearance, locale, currency, developer tools, and more
- π¨ Appearance API support with extensible theming and rule control
- π¦ Supports SetupIntents, on-submit hooks, and validation workflows
- π§ͺ Compatible with Stripe test environments and developer tooling
- π Seamless async interop with Stripe.js lifecycle
dotnet add package Soenneker.Blazor.Stripe.Elements
builder.Services.AddStripeElementsInteropAsScoped();
<StripeElements @ref="_stripeElements" StripeElementsConfiguration="_config">
<StripeAddressElement />
<StripeLinkAuthenticationElement />
<StripePaymentElement />
<Button Clicked="Submit">Submit</Button>
</StripeElements>
_config = new StripeElementsConfiguration
{
PublishableKey = "pk_test_...",
ElementsOptions = new StripeElementsOptions
{
Locale = "auto",
Currency = CurrencyCode.Usd,
Mode = StripeElementsMode.Setup,
Appearance = new StripeAppearance
{
Theme = StripeElementsTheme.Flat,
Variables = new StripeAppearanceVariablesExtended
{
ColorPrimary = "#0570de",
BorderRadius = "4px"
}
}
},
AddressOptions = new StripeAddressOptions
{
Mode = StripeAddressMode.Billing,
AllowedCountries = ["US", "CA"],
Fields = new StripeAddressFields
{
Phone = StripeAddressFieldsPhoneOption.Auto
}
}
};
Component | Purpose |
---|---|
StripeElements |
Wrapper and manager for all child elements |
StripePaymentElement |
Handles card and express payments |
StripeLinkAuthenticationElement |
Collects email and links with Stripe Link |
StripeAddressElement |
Collects billing or shipping address |
StripeElementsConfiguration |
Full C# model to control everything |
- π Stripe Elements Overview
- βοΈ Elements JavaScript API Reference
- π³ Payment Element
- π¬ Address Element
- π Link Authentication Element
- π¨ Appearance API (Theme & Styling)