KardFinancial 1.1.0

dotnet add package KardFinancial --version 1.1.0
                    
NuGet\Install-Package KardFinancial -Version 1.1.0
                    
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="KardFinancial" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KardFinancial" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="KardFinancial" />
                    
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 KardFinancial --version 1.1.0
                    
#r "nuget: KardFinancial, 1.1.0"
                    
#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 KardFinancial@1.1.0
                    
#: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=KardFinancial&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=KardFinancial&version=1.1.0
                    
Install as a Cake Tool

Kard C# Library

fern shield nuget shield

The Kard C# library provides convenient access to the Kard APIs from C#.

Table of Contents

Requirements

This SDK requires:

Installation

dotnet add package KardFinancial

Reference

A full reference for this library is available here.

Usage

Instantiate and use the client with the following:

using KardFinancial;

var client = new KardClient("client_id", "client_secret");
await client.Users.CreateAsync(
    "organization-123",
    new CreateUsersObject
    {
        Data = new List<UserRequestDataUnion>()
        {
            new UserRequestDataUnion(
                new UserRequestDataUnion.User(
                    new UserRequestData
                    {
                        Id = "1234567890",
                        Attributes = new UserRequestAttributes
                        {
                            ZipCode = "11238",
                            EnrolledRewards = new List<EnrolledRewardsType>()
                            {
                                EnrolledRewardsType.Cardlinked,
                            },
                            Email = "user@example.com",
                            HashedEmail =
                                "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3e2d8a5b76e45a1d4c4e2e3a1",
                            PhoneNumber = "+14155552671",
                            BirthYear = "1990",
                            HistoricalTransactionsSent = true,
                        },
                    }
                )
            ),
        },
    }
);

Environments

This SDK allows you to configure different environments for API requests.

using KardFinancial;

var client = new KardClient(new ClientOptions
{
    BaseUrl = KardEnvironment.Production
});

Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.

using KardFinancial;

try {
    var response = await client.Users.CreateAsync(...);
} catch (KardApiException e) {
    System.Console.WriteLine(e.Body);
    System.Console.WriteLine(e.StatusCode);
}

Advanced

Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).

Which status codes are retried depends on the retryStatusCodes generator configuration:

legacy (current default): retries on

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 5XX (All server errors, including 500)

recommended: retries on

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 502 (Bad Gateway)
  • 503 (Service Unavailable)
  • 504 (Gateway Timeout)

Use the MaxRetries request option to configure this behavior.

var response = await client.Users.CreateAsync(
    ...,
    new RequestOptions {
        MaxRetries: 0 // Override MaxRetries at the request level
    }
);

Timeouts

The SDK defaults to a 30 second timeout. Use the Timeout option to configure this behavior.

var response = await client.Users.CreateAsync(
    ...,
    new RequestOptions {
        Timeout: TimeSpan.FromSeconds(3) // Override timeout to 3s
    }
);

Raw Response

Access raw HTTP response data (status code, headers, URL) alongside parsed response data using the .WithRawResponse() method.

using KardFinancial;

// Access raw response data (status code, headers, etc.) alongside the parsed response
var result = await client.Users.CreateAsync(...).WithRawResponse();

// Access the parsed data
var data = result.Data;

// Access raw response metadata
var statusCode = result.RawResponse.StatusCode;
var headers = result.RawResponse.Headers;
var url = result.RawResponse.Url;

// Access specific headers (case-insensitive)
if (headers.TryGetValue("X-Request-Id", out var requestId))
{
    System.Console.WriteLine($"Request ID: {requestId}");
}

// For the default behavior, simply await without .WithRawResponse()
var data = await client.Users.CreateAsync(...);

Additional Headers

If you would like to send additional headers as part of the request, use the AdditionalHeaders request option.

var response = await client.Users.CreateAsync(
    ...,
    new RequestOptions {
        AdditionalHeaders = new Dictionary<string, string?>
        {
            { "X-Custom-Header", "custom-value" }
        }
    }
);

Additional Query Parameters

If you would like to send additional query parameters as part of the request, use the AdditionalQueryParameters request option.

var response = await client.Users.CreateAsync(
    ...,
    new RequestOptions {
        AdditionalQueryParameters = new Dictionary<string, string>
        {
            { "custom_param", "custom-value" }
        }
    }
);

Forward Compatible Enums

This SDK uses forward-compatible enums that can handle unknown values gracefully.

using KardFinancial;

// Using a built-in value
var cardNetwork = CardNetwork.Visa;

// Using a custom value
var customCardNetwork = CardNetwork.FromCustom("custom-value");

// Using in a switch statement
switch (cardNetwork.Value)
{
    case CardNetwork.Values.Visa:
        Console.WriteLine("Visa");
        break;
    default:
        Console.WriteLine($"Unknown value: {cardNetwork.Value}");
        break;
}

// Explicit casting
string cardNetworkString = (string)CardNetwork.Visa;
CardNetwork cardNetworkFromString = (CardNetwork)"VISA";

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

Product 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 is compatible.  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 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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. 
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
1.1.0 29 5/12/2026
1.0.1 49 5/7/2026
1.0.0 45 5/6/2026
0.0.6 41 5/6/2026
0.0.5 45 5/6/2026