Dloizides.Payments.AspNetCore
1.0.2
dotnet add package Dloizides.Payments.AspNetCore --version 1.0.2
NuGet\Install-Package Dloizides.Payments.AspNetCore -Version 1.0.2
<PackageReference Include="Dloizides.Payments.AspNetCore" Version="1.0.2" />
<PackageVersion Include="Dloizides.Payments.AspNetCore" Version="1.0.2" />
<PackageReference Include="Dloizides.Payments.AspNetCore" />
paket add Dloizides.Payments.AspNetCore --version 1.0.2
#r "nuget: Dloizides.Payments.AspNetCore, 1.0.2"
#:package Dloizides.Payments.AspNetCore@1.0.2
#addin nuget:?package=Dloizides.Payments.AspNetCore&version=1.0.2
#tool nuget:?package=Dloizides.Payments.AspNetCore&version=1.0.2
Payments.AspNetCore
Reusable one-time payment processing for multi-tenant ASP.NET Core SaaS. Pairs Stripe Checkout + a Revolut-link adapter (for the existing manual flow) + a webhook handler. Per-tenant provider selection.
Sibling to Subscriptions.AspNetCore — this is for attendee-pays-tenant; that one is for tenant-pays-platform.
Concepts
PaymentProviderKind—None/RevolutLink/StripeCheckout.IPaymentProvider— one implementation per kind; resolves the attendee's payment session.IPaymentProviderResolver— looks up the right provider for a tenant's configured kind.PaymentRequest— tenant id + line item + amount + URLs.PaymentSessionResult— provider's URL the attendee is redirected to + the provider's session id.StripePaymentWebhookHandler— HMAC-verified Stripe webhook, firesPaymentEventReceivedfor the consumer's payment-store layer.
Wiring
Program.cs:
builder.Services.AddPayments(builder.Configuration);
app.MapPaymentsWebhook(); // POST /api/webhooks/stripe-payments
// Consumer subscribes once at startup:
var handler = app.Services.GetRequiredService<StripePaymentWebhookHandler>();
handler.PaymentEventReceived += async (evt, ct) =>
{
// Update your Payment row + downstream Attendee.Status etc.
};
appsettings.json:
{
"Payments": {
"Stripe": {
"SecretKey": "sk_test_...",
"WebhookSecret": "whsec_..."
}
}
}
Per-tenant provider choice
The package does NOT pick the provider — each tenant stores its choice in its own payment-config row, then the consumer resolves at session-creation time:
var kind = tenant.PaymentConfig.ProviderKind;
var provider = resolver.Resolve(kind)
?? throw new InvalidOperationException($"No provider for {kind}.");
var session = await provider.CreateSessionAsync(new PaymentRequest(
TenantId: tenant.Id,
PaymentReference: attendeeExternalId.ToString(),
Description: $"{eventName} — {passLabel}",
AmountEur: passPrice,
CustomerEmail: attendeeEmail,
SuccessUrl: $"https://{tenantSlug}.kefi.dloizides.com/ticket/{token}",
CancelUrl: $"https://{tenantSlug}.kefi.dloizides.com/"));
Revolut-link semantics
The RevolutLink provider is a thin adapter — no API call, no webhook,
no automatic confirmation. The tenant's Revolut URL is passed via the
request's SuccessUrl; the provider returns it verbatim as the hosted
URL. The organizer manually matches the Revolut transfer reference
against the request's PaymentReference (typically the attendee's
external id) to confirm payment.
Future providers
IPaymentProvider is open — drop in RevolutBusinessApi, PayPalCheckout,
Klarna, etc. by implementing the interface + registering in DI. The
resolver picks them up by kind.
| Product | Versions 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. |
-
net10.0
- Stripe.net (>= 47.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.