C# SDK
Install and start using the C# SDK.
Intro
The Global Payments API SDK provides access to the Global Payments API REST APIs.
GP API: one REST API for payments, payment methods, 3-D Secure, merchants, funds, disputes and reporting across Global Payments' platforms.
Installation
Add the SDK as a project reference into your solution:
dotnet add reference <path-to-sdk>/src/GlobalPaymentsApi/GlobalPaymentsApi.csprojThe project takes its build settings from the files around it, so reference it in place.
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 GlobalPaymentsApiClientOptions.
services.AddGlobalPaymentsApiClient(options =>
{
options.BearerAuth = "YOUR_BEARER_TOKEN";
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 GlobalPaymentsApiClientOptions.
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new GlobalPaymentsApiClientOptions
{
BearerAuth = "YOUR_BEARER_TOKEN",
Environment = ServerEnvironment.Production,
};
var client = new GlobalPaymentsApiClient(httpClient, options);