TailoredApps.Shared.Payments.Provider.Adyen
2.1.2
See the version list below for details.
dotnet add package TailoredApps.Shared.Payments.Provider.Adyen --version 2.1.2
NuGet\Install-Package TailoredApps.Shared.Payments.Provider.Adyen -Version 2.1.2
<PackageReference Include="TailoredApps.Shared.Payments.Provider.Adyen" Version="2.1.2" />
<PackageVersion Include="TailoredApps.Shared.Payments.Provider.Adyen" Version="2.1.2" />
<PackageReference Include="TailoredApps.Shared.Payments.Provider.Adyen" />
paket add TailoredApps.Shared.Payments.Provider.Adyen --version 2.1.2
#r "nuget: TailoredApps.Shared.Payments.Provider.Adyen, 2.1.2"
#:package TailoredApps.Shared.Payments.Provider.Adyen@2.1.2
#addin nuget:?package=TailoredApps.Shared.Payments.Provider.Adyen&version=2.1.2
#tool nuget:?package=TailoredApps.Shared.Payments.Provider.Adyen&version=2.1.2
TailoredApps.Shared.Payments.Provider.Adyen
Adyen is a global payment operator (cards, BLIK, iDEAL and other methods). This package plugs the Adyen Checkout API v71 into
TailoredApps.Shared.Payments: it creates a hosted checkout session and returns the address of Adyen's payment page, reads
the outcome of a session, and verifies and handles standard Adyen webhooks.
Installation
dotnet add package TailoredApps.Shared.Payments.Provider.Adyen # brings TailoredApps.Shared.Payments with it
Registration
using TailoredApps.Shared.Payments;
using TailoredApps.Shared.Payments.Provider.Adyen;
builder.Services.AddPayments().RegisterAdyenProvider();
The call registers the provider with its dependencies and adds it to IPaymentService. Several providers chain:
.AddPayments().RegisterAdyenProvider().RegisterTpayProvider().
Configuration
Options are bound from the Payments:Providers:Adyen section (AdyenServiceOptions).
{
"Payments": {
"Providers": {
"Adyen": {
"ApiKey": "<adyen-api-key>",
"MerchantAccount": "<merchant-account>",
"NotificationHmacKey": "<webhook-hmac-key-hex>",
"ReturnUrl": "https://shop.example/payment/return",
"Environment": "test"
}
}
}
}
| Key | Required | Meaning | Default |
|---|---|---|---|
ApiKey |
yes | API key, sent in the X-API-Key header |
- |
MerchantAccount |
yes | Merchant account the sessions are created for | - |
NotificationHmacKey |
yes | HMAC key of the webhook, as a hex string | - |
ReturnUrl |
no | Address Adyen sends the shopper back to (returnUrl of the session) |
empty |
Environment |
no | test calls https://checkout-test.adyen.com/v71; any other value calls https://checkout-live.adyen.com/v71. IsTest (true / false) is the same switch |
test |
CheckoutUrl |
no | Full base URL of the Checkout API; when set it replaces the address derived from Environment |
not set |
ClientKey |
no | Bound from configuration, but not used by the provider | empty |
A required key that is missing stops the host at startup with OptionsValidationException. The other keys are not validated.
Usage
// payments is an injected IPaymentService
var response = await payments.RegisterPayment(new PaymentRequest("Adyen", 49.99m, "PLN")
{
Email = "buyer@example.com",
AdditionalData = "order-7", // sent as the session reference; comes back as merchantReference in the webhook
}, cancellationToken);
return Redirect(response.RedirectUrl); // response.PaymentUniqueId is the session id
When the shopper comes back, the return address carries the sessionId and sessionResult query parameters:
var payment = await payments.GetStatus("Adyen", AdyenProvider.SessionResultId(sessionId, sessionResult), cancellationToken);
Webhooks
Adyen posts JSON with a notificationItems array. There is no signature header: each NotificationRequestItem carries
additionalData.hmacSignature, the Base64 HMAC-SHA256 (key: NotificationHmacKey decoded from hex) of eight fields joined
with a colon - pspReference, originalReference, merchantAccountCode, merchantReference, amount.value,
amount.currency, eventCode, success (an absent field is an empty string). The first item of the array is handled.
using var reader = new StreamReader(Request.Body, Encoding.UTF8);
var body = await reader.ReadToEndAsync(cancellationToken); // raw body, not [FromBody]
var result = await payments.HandleWebhookAsync("Adyen", new PaymentWebhookRequest { Body = body }, cancellationToken);
return result is PaymentWebhookRejected ? BadRequest() : Content(AdyenProvider.Acknowledgement, "text/plain");
eventCode |
success |
Result |
|---|---|---|
AUTHORISATION, REFUND |
true |
PaymentWebhookProcessed, Payment.PaymentStatus = Finished |
AUTHORISATION, REFUND |
anything else or absent | PaymentWebhookProcessed, Payment.PaymentStatus = Rejected |
CANCELLATION, AUTHORISATION_FAILED |
any | PaymentWebhookProcessed, Payment.PaymentStatus = Rejected |
| another event | any | PaymentWebhookIgnored |
A wrong or missing signature gives PaymentWebhookRejected (InvalidSignature); a body that is not JSON or has no
NotificationRequestItem gives PaymentWebhookRejected (MalformedPayload).
Good to know
- Answer an accepted notification, an ignored one included, with HTTP 200 and the body
[accepted](AdyenProvider.Acknowledgement). GetStatusneeds the id built byAdyenProvider.SessionResultId(sessionId, sessionResult); a bare session id throwsArgumentException. It mapscompletedtoFinished,paymentPendingtoProcessing,refused,canceledandexpiredtoRejected, anything else toCreated.Payment.PaymentUniqueIdof a webhook result ismerchantReference(yourAdditionalData), orpspReferencewhen it is empty - not the session id. WithoutAdditionalDatathe provider sends a random reference, so always set it.- The signature covers only the eight fields above. Do not base decisions on other fields of the notification.
- A failing gateway is an exception, not a rejected payment:
RegisterPaymentthrowsPaymentGatewayException(derives fromHttpRequestException) on 5xx, 408 or 429, andGetStatusthrows it on any answer outside 2xx. Another refusal of a session returnsRejectedwith Adyen's answer inResponseObject. Requests go through the named HTTP clientAdyen.
Documentation
| 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. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Options (>= 10.0.15)
- TailoredApps.Shared.Payments (>= 2.1.2)
-
net11.0
- Microsoft.Extensions.Configuration.Binder (>= 11.0.0)
- Microsoft.Extensions.Http (>= 11.0.0)
- TailoredApps.Shared.Payments (>= 2.1.2)
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 | 44 | 12/2/2026 |
| 3.0.0-preview.2 | 62 | 11/12/2026 |
| 3.0.0-preview.1 | 67 | 11/12/2026 |
| 2.1.2 | 46 | 12/2/2026 |
| 2.1.1 | 55 | 12/2/2026 |
| 2.1.0 | 103 | 11/12/2026 |
| 2.0.1 | 89 | 11/12/2026 |
| 2.0.0 | 127 | 11/12/2026 |
| 1.6.0 | 93 | 11/12/2026 |
| 1.4.19 | 113 | 10/26/2026 |
| 1.4.18 | 106 | 10/23/2026 |
| 1.4.17 | 115 | 10/6/2026 |
| 1.4.16 | 114 | 9/28/2026 |
| 1.4.15 | 119 | 9/21/2026 |
| 1.4.14 | 125 | 8/20/2026 |
| 1.4.13 | 119 | 8/20/2026 |
| 1.4.12 | 131 | 8/20/2026 |
| 1.4.11 | 133 | 8/7/2026 |
| 1.4.10 | 143 | 7/8/2026 |
| 1.4.9 | 139 | 7/8/2026 |