Getting Started with PayPal Server SDK

June 5, 2026 ยท View on GitHub

Introduction

Important Notes

  • Available Features: This SDK currently contains only 5 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future.

Information

The PayPal Server SDK provides integration access to the PayPal REST APIs. The API endpoints are divided into distinct controllers:

Install the Package

If you are building with .NET CLI tools then you can also use the following command:

dotnet add package PayPalServerSDK --version 2.3.0

You can also view the package at: https://www.nuget.org/packages/PayPalServerSDK/2.3.0

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

ParameterTypeDescription
EnvironmentEnvironmentThe API environment.
Default: Environment.Sandbox
TimeoutTimeSpanHttp client timeout.
Default: TimeSpan.FromSeconds(100)
HttpClientConfigurationAction<HttpClientConfiguration.Builder>Action delegate that configures the HTTP client by using the HttpClientConfiguration.Builder for customizing API call settings.
Default: new HttpClient()
LogBuilderLogBuilderRepresents the logging configuration builder for API calls
ClientCredentialsAuthClientCredentialsAuthThe Credentials Setter for OAuth 2 Client Credentials Grant

The API client can be initialized as follows:

Code-Based Initialization

using Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;

namespace ConsoleApp;

PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
    .ClientCredentialsAuth(
        new ClientCredentialsAuthModel.Builder(
            "OAuthClientId",
            "OAuthClientSecret"
        )
        .Build())
    .HttpClientConfig(httpClientConfig =>
        httpClientConfig.Timeout(TimeSpan.FromSeconds(100)))
    .Environment(PaypalServerSdk.Standard.Environment.Sandbox)
    .LoggingConfig(config => config
        .LogLevel(LogLevel.Information)
        .RequestConfig(reqConfig => reqConfig.Body(true))
        .ResponseConfig(respConfig => respConfig.Headers(true))
    )
    .Build();

Configuration-Based Initialization

using PaypalServerSdk.Standard;
using Microsoft.Extensions.Configuration;

namespace ConsoleApp;

// Build the IConfiguration using .NET conventions (JSON, environment, etc.)
var configuration = new ConfigurationBuilder()
    .AddJsonFile("config.json")
    .AddEnvironmentVariables() // [optional] read environment variables
    .Build();

// Instantiate your SDK and configure it from IConfiguration
var client = PaypalServerSdkClient
    .FromConfiguration(configuration.GetSection("PaypalServerSdk"));

See the Configuration-Based Initialization section for details.

Environments

The SDK can be configured to use a different environment for making API calls. Available environments are:

Fields

NameDescription
ProductionPayPal Live Environment
SandboxDefault PayPal Sandbox Environment

Authorization

This API uses the following authentication schemes.

List of APIs

SDK Infrastructure

Configuration

HTTP

Utilities