C# SDK

Install and start using the C# SDK.

Intro

The Payrix SDK provides access to the Payrix REST APIs.

**Beta SDKs Disclaimer**

Worldpay for Platforms provides beta software development kits (SDKs) for the Payrix Pro REST API, auto-generated by APIMatic in .NET, Java, PHP, Python, Ruby, and TypeScript. Use of Payrix Pro SDKs is optional and at your own risk. Worldpay for Platforms does not provide implementation or troubleshooting support for SDK-specific issues. For important limitations, support details, and compliance requirements, see the Payrix Pro API Beta SDKs Disclaimer.

Installation

To add the SDK to your project from NuGet:

Terminal
dotnet add package PayrixGPApimaticSDK

To build against the SDK source instead, add it as a project reference into your solution:

Terminal
dotnet add reference <path-to-sdk>/Payrix.csproj

Quick Start

Dependency Injection

Register the client with IServiceCollection and resolve it from the container. The HttpClient is managed by IHttpClientFactory. Configure the client's behavior through PayrixClientOptions.

C#
services.AddPayrixClient(options =>
{
    options.ApiKey = "YOUR_API_KEY";
    options.SessionKey = "YOUR_API_KEY";
    options.TxnSessionKey = "YOUR_API_KEY";
    options.Username = "YOUR_API_KEY";
    options.Password = "YOUR_API_KEY";
    options.Environment = ServerEnvironment.Production;
    // TODO: configure more client options here
});

Direct Instantiation

Create the client by passing an HttpClient you manage yourself. Configure the client's behavior through PayrixClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new PayrixClientOptions
{
    ApiKey = "YOUR_API_KEY",
    SessionKey = "YOUR_API_KEY",
    TxnSessionKey = "YOUR_API_KEY",
    Username = "YOUR_API_KEY",
    Password = "YOUR_API_KEY",
    Environment = ServerEnvironment.Production,
};
var client = new PayrixClient(httpClient, options);

On this page