RyftPay.Net
1.1.0
dotnet add package RyftPay.Net --version 1.1.0
NuGet\Install-Package RyftPay.Net -Version 1.1.0
<PackageReference Include="RyftPay.Net" Version="1.1.0" />
<PackageVersion Include="RyftPay.Net" Version="1.1.0" />
<PackageReference Include="RyftPay.Net" />
paket add RyftPay.Net --version 1.1.0
#r "nuget: RyftPay.Net, 1.1.0"
#:package RyftPay.Net@1.1.0
#addin nuget:?package=RyftPay.Net&version=1.1.0
#tool nuget:?package=RyftPay.Net&version=1.1.0
Ryft .NET SDK
The Ryft .Net SDK allows you to consume our payments API within your .Net applications
Prerequisites
The SDK supports the following targets:
.NET 8.0
and above.NET Framework 4.8
and above.netstandard2.0
Note that it has been tested against .NET 8.0
and .NET Framework 4.8
.
These targets or later are recommended.
Installation
The SDK is available on NuGet
with NuGet
PM> Install-Package RyftPay.Net -Version x.x.x
Usage
Each resource from our API is provided individually.
For example, to begin interfacing with our /payment-sessions
resources, initialise the API client:
Initialisation
All API clients require an instance of IRyftApiClient
, which can be constructed in several ways:
var apiClient = new RyftApiClient();
// or with your own HttpClient
var apiClient = new RyftApiClient(new HttpClient());
// or with IHttpClientFactory
var apiClient = new RyftApiClient(httpClientFactory);
You API key can be supplied on either the RyftApiClient
or per-request.
var apiClient = new RyftApiClient(
requestSettings: new ClientRequestSettings { ApiKey = "<your API key>" }
);
var paymentSessionsApiClient = new PaymentSessionsApiClient(apiClient);
Making requests
var request = new CreatePaymentSessionRequest(500, "GBP")
{
CaptureFlow = CaptureFlow.Manual,
CustomerEmail = "test@ryftpay.com"
};
var paymentSession = await paymentSessionsApiClient.CreateAsync(request);
// request with API key supplied
var paymentSession = await paymentSessionsApiClient.CreateAsync(
request,
requestSettings: new ClientRequestSettings { ApiKey = "<your API key>" }
);
Handling Webhook Events
Note that the SDK does not support
Event
objects persisted prior to August 2025
Verifying the signature (Recommended)
Every webhook event is delivered with a Signature
header which you can use to verify the integrity of the message.
This header value is derived from calculating a HMAC-SHA256
of the raw response body alongside your webhook secret.
You can leverage our built-in class to perform this check as follows:
string signature = Request.Headers['Signature'];
string webhookSecret = "<dervie this from your backend (e.g. env var)>";
string payload = "<supply the unmodified raw string (JSON) from the request>";
var webhookHandler = new WebhookHandler();
bool isValid = webhookHandler.IsSignatureValid(webhookSecret, signature, payload);
Parsing the event
To parse the incoming event, you can again leverage the WebhookHandler
class as follows:
string payload = "<supply the unmodified raw string (JSON) from the request>";
var webhookHandler = new WebhookHandler();
try
{
var @event = webhookHandler.ConstructEvent(payload);
// you can then access the underlying API response model based on the event type, e.g.
if (@event.EventType == EventTypes.CustomerCreated)
{
var customer = @event.Data.Object as Customer;
}
// always return a 200 status code to confirm you have received the event successfully
return Ok();
}
catch (RyftDotNetException e)
{
// the event could not be parsed/constructed
}
Notes on design decisions
Enumeration Types
We consider adding new enums to our API as non-breaking and non-major upgrades. Keep this in mind when using the SDK.
We have intentionally:
- avoided using strict
Enum
values for use on request and response models - opted for enumeration classes instead.
This allows for requests to be more easily discover which values are available whilst at the same time, new values can be returned from our API without the SDK erroring. We will release a minor version update when new values are introduced.
Constructors vs Properties
Constructor parameters map to required fields on our API reference. Property setters are utilised for optional parameters.
e.g. When creating a payment session, amount
and currency
are required fields.
var request = new CreatePaymentSessionRequest(500, "GBP");
To supply any additional (optional) parameters, use the properties available:
var request = new CreatePaymentSessionRequest(500, "GBP")
{
CaptureFlow = CaptureFlow.Manual,
CustomerEmail = "test@ryftpay.com"
};
Contributing
We welcome contributors, please see our Contributing guidelines
Code of Conduct
Please refer to Code of Conduct
Licensing
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Extensions.Http (>= 9.0.2)
- System.Text.Json (>= 9.0.1)
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Extensions.Http (>= 9.0.2)
- System.Text.Json (>= 9.0.1)
-
net8.0
- Microsoft.Extensions.Http (>= 9.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.