Coder Social home page Coder Social logo

rest-api-sdk-dotnet's Introduction

The repository contains the PayPal PaymentSDK C#.NET Class Library Application and the PaymentSDKUnitTest C#.NET Visual Studio Test Application.

Before starting to use the sdk, please be aware of the existing issues and currently available or upcoming features for the REST APIs. (which the sdks are based on)

Prerequisites

  • Visual Studio 2008 or higher
  • log4net 1.2.10
  • NuGet 2.2
  • Note: NuGet 2.2 requires .NET Framework 4.0

To make an API call

  • Add references to the following libraries in your project.

    • RestApiSDK
    • PayPalCoreSDK.dll
    • Newtonsoft.Json.dll
    • log4net.dll 1.2.10.0
  • Refer to the App.config file configuration file settings

  • Create 'accesstoken' from 'ClientID' and 'ClientSecret' using OAuthTokenCredential and set the same in resource as follows,

    // Retrieve the access token from // OAuthTokenCredential by passing in // ClientID and ClientSecret // It is not mandatory to generate Access Token on a per call basis. // Typically the access token can be generated once and // reused within the expiry window string accessToken = new OAuthTokenCredential(ConfigManager.Instance.GetProperties()["ClientID"], ConfigManager.Instance.GetProperties()["ClientSecret"]).GetAccessToken();

  • Depending on the context of API calls, calling method may be static or non-static (For example, most 'GET' http methods are created as static methods within the resource).

If it is static, invoke it as a class method as seen here

		// Retrieve the payment object by calling the
		// static `Get` method
		// on the Payment class by passing a valid
		// AccessToken and Payment ID
		Payment pymnt = Payment.Get(accessToken, "PAY-0XL713371A312273YKE2GCNI");

If it is non-static, invoke it using resource object using the following syntax

		// A Payment Resource; create one using
		// the above types and intent as `sale`
		Payment pymnt = new Payment();
		pymnt.intent = "sale";
		...
		...
		pymnt.Create(accessToken);

App.Config Configuration

  • endpoint
  • ClientID
  • ClientSecret

NuGet

NuGet is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. If you develop a library or tool that you want to share with other developers, you create a NuGet package and store the package in a NuGet repository. If you want to use a library or tool that someone else has developed, you retrieve the package from the repository and install it in your Visual Studio project or solution. When you install the package, NuGet copies files to your solution and automatically makes whatever changes are needed, such as adding references and changing your app.config or web.config file. If you decide to remove the library, NuGet removes files and reverses whatever changes it made in your project so that no clutter is left.

Here is how you can get NuGet working on your IDE -

License

  • PayPal, Inc. SDK License - LICENSE.txt

Bitdeli Badge

rest-api-sdk-dotnet's People

Contributors

lvairamani avatar kumaravel-jayakumar avatar jziaja avatar avijit6399 avatar buntyjoshi avatar lathavairamani avatar aydiv avatar neilrees avatar siddick avatar avidas avatar

Watchers

James Cloos avatar Rui Marinho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.