Skip to content

paypal/PayPal-Dotnet-Server-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Paypal Server SDK

Introduction

An order represents a payment between two or more parties. Use the Orders API to create, update, retrieve, authorize, and capture orders., Call the Payments API to authorize payments, capture authorized payments, refund payments that have already been captured, and show payment information. Use the Payments API in conjunction with the Orders API. For more information, see the PayPal Checkout Overview., The Payment Method Tokens API saves payment methods so payers don't have to enter details for future transactions. Payers can check out faster or pay without being present after they agree to save a payment method.

The API associates a payment method with a temporary setup token. Pass the setup token to the API to exchange the setup token for a permanent token.

The permanent token represents a payment method that's saved to the vault. This token can be used repeatedly for checkout or recurring transactions such as subscriptions.

The Payment Method Tokens API is available in the US only.

Find out more here: https://developer.paypal.com/docs/api/orders/v2/

Install the Package

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

dotnet add package PayPalServerSDK --version 0.5.1

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

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

Parameter Type Description
Environment Environment The API environment.
Default: Environment.Sandbox
Timeout TimeSpan Http client timeout.
Default: TimeSpan.FromSeconds(100)
LogBuilder LogBuilder Represents the logging configuration builder for API calls
ClientCredentialsAuth ClientCredentialsAuth The Credentials Setter for OAuth 2 Client Credentials Grant

The API client can be initialized as follows:

PaypalServerSDKClient client = new PaypalServerSDKClient.Builder()
    .ClientCredentialsAuth(
        new ClientCredentialsAuthModel.Builder(
            "OAuthClientId",
            "OAuthClientSecret"
        )
        .Build())
    .Environment(PaypalServerSDK.Standard.Environment.Sandbox)
    .LoggingConfig(config => config
        .LogLevel(LogLevel.Information)
        .RequestConfig(reqConfig => reqConfig.Body(true))
        .ResponseConfig(respConfig => respConfig.Headers(true))
    )
    .Build();

API calls return an ApiResponse object that includes the following fields:

Field Description
StatusCode Status code of the HTTP response
Headers Headers of the HTTP response as a Hash
Data The deserialized body of the HTTP response as a String

Environments

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

Fields

Name Description
Production PayPal Live Environment
Sandbox Default PayPal Sandbox Environment

Authorization

This API uses the following authentication schemes.

List of APIs

Classes Documentation