TailoredApps.Shared.Payments.Provider.Stripe 2.1.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TailoredApps.Shared.Payments.Provider.Stripe --version 2.1.2
                    
NuGet\Install-Package TailoredApps.Shared.Payments.Provider.Stripe -Version 2.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TailoredApps.Shared.Payments.Provider.Stripe" Version="2.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailoredApps.Shared.Payments.Provider.Stripe" Version="2.1.2" />
                    
Directory.Packages.props
<PackageReference Include="TailoredApps.Shared.Payments.Provider.Stripe" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TailoredApps.Shared.Payments.Provider.Stripe --version 2.1.2
                    
#r "nuget: TailoredApps.Shared.Payments.Provider.Stripe, 2.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TailoredApps.Shared.Payments.Provider.Stripe@2.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TailoredApps.Shared.Payments.Provider.Stripe&version=2.1.2
                    
Install as a Cake Addin
#tool nuget:?package=TailoredApps.Shared.Payments.Provider.Stripe&version=2.1.2
                    
Install as a Cake Tool

TailoredApps.Shared.Payments.Provider.Stripe

Stripe is a global payment operator. This package plugs Stripe Checkout into TailoredApps.Shared.Payments through the Stripe.net SDK: it creates a Checkout Session and returns the address of Stripe's hosted payment page, reads the status of a session, and verifies and handles Stripe webhooks.

Installation

dotnet add package TailoredApps.Shared.Payments.Provider.Stripe   # brings TailoredApps.Shared.Payments with it

Registration

using TailoredApps.Shared.Payments;
using TailoredApps.Shared.Payments.Provider.Stripe;

builder.Services.AddPayments().RegisterStripeProvider();

The call registers the provider with its dependencies and adds it to IPaymentService. Several providers chain: .AddPayments().RegisterStripeProvider().RegisterTpayProvider().

Configuration

Options are bound from the Payments:Providers:Stripe section (StripeServiceOptions).

{
  "Payments": {
    "Providers": {
      "Stripe": {
        "SecretKey": "<stripe-secret-key>",
        "WebhookSecret": "<webhook-signing-secret>",
        "SuccessUrl": "https://shop.example/payment/success?session={CHECKOUT_SESSION_ID}",
        "CancelUrl": "https://shop.example/payment/cancelled"
      }
    }
  }
}
Key Required Meaning Default
SecretKey yes Stripe secret key; passed with every SDK call -
WebhookSecret yes Signing secret of the webhook endpoint -
SuccessUrl no Return address after a payment; Stripe replaces {CHECKOUT_SESSION_ID} with the session id empty
CancelUrl no Return address after the payer cancels empty

A required key that is missing stops the host at startup with OptionsValidationException. The other keys are not validated.

The payment methods of a session can be set with a separate list at Stripe:AllowedPaymentMethods (top level, not under Payments:Providers). Without it the provider uses card and blik for PLN, card and sepa_debit for EUR, card otherwise.

Usage

// payments is an injected IPaymentService
var response = await payments.RegisterPayment(new PaymentRequest("Stripe", 49.99m, "PLN")
{
    Title = "Order 7",              // sent as the product name of the session's line item
    Email = "buyer@example.com",
    AdditionalData = "order-7",     // stored in the session metadata as additional_data
}, cancellationToken);

return Redirect(response.RedirectUrl);

response.PaymentUniqueId is the Checkout Session id; pass it to GetStatus("Stripe", sessionId).

Webhooks

Stripe posts a JSON event and signs the raw body in the Stripe-Signature header. The provider verifies it with Stripe.net (EventUtility.ConstructEvent) and WebhookSecret; an event whose API version differs from the SDK's is still accepted.

using var reader = new StreamReader(Request.Body, Encoding.UTF8);
var result = await payments.HandleWebhookAsync("Stripe", new PaymentWebhookRequest
{
    Body = await reader.ReadToEndAsync(cancellationToken),   // raw body, not [FromBody]
    Headers = Request.Headers.ToDictionary(h => h.Key, h => h.Value),
}, cancellationToken);
return result is PaymentWebhookRejected ? BadRequest() : Ok();
Event Result
checkout.session.completed with payment_status paid, checkout.session.async_payment_succeeded PaymentWebhookProcessed, Finished, session id
checkout.session.async_payment_failed, checkout.session.expired PaymentWebhookProcessed, Rejected, session id
payment_intent.succeeded / payment_intent.payment_failed PaymentWebhookProcessed, Finished / Rejected, payment intent id
checkout.session.completed not yet paid, any other event, an event without an id PaymentWebhookIgnored
signature missing or wrong, or WebhookSecret not configured PaymentWebhookRejected (PaymentWebhookRejection.InvalidSignature)

Good to know

  • Failures of the Stripe API surface as StripeException from RegisterPayment and GetStatus, not as PaymentGatewayException. RegisterPayment never returns Rejected; treat the exception as an unknown state.
  • payment_intent.* events carry the payment intent id in Payment.PaymentUniqueId, not the session id RegisterPayment returned. To match webhooks with stored session ids, act on the checkout.session.* events.
  • GetStatus maps a complete session that is paid to Finished, a complete session that is not paid to Processing, expired to Rejected, anything else to Created.
  • The amount is sent in the minor unit (amount x 100), except for Stripe's zero-decimal currencies such as JPY.
  • GetChannels returns a fixed list per currency (PLN: card, blik, p24; EUR: card, sepa_debit; other: card). PaymentRequest.PaymentChannel does not select a method; it is stored in the session metadata as payment_channel.

Documentation

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-preview.3 41 12/2/2026
3.0.0-preview.2 56 11/12/2026
3.0.0-preview.1 66 11/12/2026
2.1.2 42 12/2/2026
2.1.1 57 12/2/2026
2.1.0 112 11/12/2026
2.0.1 101 11/12/2026
2.0.0 128 11/12/2026
1.6.0 103 11/12/2026
1.4.19 143 10/26/2026
1.4.18 102 10/23/2026
1.4.17 111 10/6/2026
1.4.16 110 9/28/2026
1.4.15 108 9/21/2026
1.4.14 122 8/20/2026
1.4.13 132 8/20/2026
1.4.12 119 8/20/2026
1.4.11 127 8/7/2026
1.4.10 143 7/8/2026
1.4.9 133 7/8/2026
Loading failed