TailoredApps.Shared.Payments 3.0.0-preview.2

This is a prerelease version of TailoredApps.Shared.Payments.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TailoredApps.Shared.Payments --version 3.0.0-preview.2
                    
NuGet\Install-Package TailoredApps.Shared.Payments -Version 3.0.0-preview.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" Version="3.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailoredApps.Shared.Payments" Version="3.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="TailoredApps.Shared.Payments" />
                    
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 --version 3.0.0-preview.2
                    
#r "nuget: TailoredApps.Shared.Payments, 3.0.0-preview.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@3.0.0-preview.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&version=3.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=TailoredApps.Shared.Payments&version=3.0.0-preview.2&prerelease
                    
Install as a Cake Tool

TailoredApps.Shared.Payments

One interface, IPaymentService, in front of several payment gateways. A provider package per gateway (TailoredApps.Shared.Payments.Provider.*: Adyen, CashBill, HotPay, PayNow, PayU, Przelewy24, Revolut, Stripe, Tpay) plugs into it; the application starts payments, reads their status and handles webhooks the same way for all of them.

Usage

// Program.cs
builder.Services
    .AddPayments()
    .RegisterTpayProvider();
// PaymentProvider, Amount and Currency are required members.
var response = await payments.RegisterPayment(new PaymentRequest("Tpay", 49.99m, "PLN")
{
    Title = "Order 7",
    Email = "buyer@example.com",
    AdditionalData = "order-7",   // your own reference; it identifies the payment in Tpay and Adyen webhooks
}, cancellationToken);

return Redirect(response.RedirectUrl);

Three things an application has to handle

1. A failing gateway is an exception, not a rejected payment. RegisterPayment and GetStatus return PaymentStatusEnum.Rejected only when the gateway said so. When the gateway is failing, refuses a status query or cannot be reached, they throw PaymentGatewayException (derives from HttpRequestException): the state of the payment is not known and an order must not be cancelled on that basis.

try
{
    var payment = await payments.GetStatus("Tpay", paymentId, cancellationToken);
    // act on payment.PaymentStatus
}
catch (HttpRequestException exception)   // covers PaymentGatewayException
{
    // unknown state: leave the order as it is and check again later
}

Every provider reports such failures this way. Stripe does so from 3.0, with the SDK's StripeException as InnerException; in 2.x it threw StripeException.

2. PaymentRequest requires PaymentProvider, Amount and Currency. An object initializer that leaves one out does not compile (CS9035), and System.Text.Json refuses a document without them.

3. Webhooks need the raw request body. Gateways sign the exact bytes they send. Read the body from the request stream (not through [FromForm] or [FromBody]), pass it with every header to HandleWebhookAsync, and act on the result: PaymentWebhookProcessed, PaymentWebhookIgnored or PaymentWebhookRejected. Tpay and Adyen expect a specific answer body (TpayProvider.Acknowledgement, AdyenProvider.Acknowledgement) and identify the payment by the reference you sent in PaymentRequest.AdditionalData.

Upgrading from 1.x

The three points above are the changes that affect application code. The full guide, with before/after examples: https://shared.tailoredapps.pl/en/Migration/v2/

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 (9)

Showing the top 5 NuGet packages that depend on TailoredApps.Shared.Payments:

Package Downloads
TailoredApps.Shared.Payments.Provider.CashBill

Package Description

TailoredApps.Shared.Payments.Provider.Przelewy24

Package Description

TailoredApps.Shared.Payments.Provider.Adyen

Package Description

TailoredApps.Shared.Payments.Provider.Stripe

Package Description

TailoredApps.Shared.Payments.Provider.Revolut

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-preview.3 53 12/2/2026
3.0.0-preview.2 100 11/12/2026
3.0.0-preview.1 111 11/12/2026
2.1.2 67 12/2/2026
2.1.1 95 12/2/2026
2.1.0 214 11/12/2026
2.0.1 195 11/12/2026
2.0.0 219 11/12/2026
1.6.0 447 11/12/2026
1.4.19 452 10/26/2026
1.4.18 494 10/23/2026
1.4.17 573 10/6/2026
1.4.16 243 9/28/2026
1.4.15 253 9/21/2026
1.4.14 323 8/20/2026
1.4.13 304 8/20/2026
1.4.12 311 8/20/2026
1.4.11 278 8/7/2026
1.4.10 323 7/8/2026
1.4.9 319 7/8/2026
Loading failed