Multi-framework PayPal SDK for .NET developers targeting different frameworks and run-times e.g .NET Framework, .NET Core, and .NETStandard
It is important to note that the original SDK was written by the original developers i.e PayPal and their repository can be found here if any questions arise.
This version transforms the original code in order to target other frameworks such as .NET Standard & Core which are not factored for in the original source code.
Install the SDK package from Nuget by running the following command in Package Manager Console.
Install-Package PayPal.MultiTarget -Version 1.0.1
Once installed, you need to define the configuration file from which the package will read settings from. If you have a Web.config or App.config file, just copy the settings below and them to your file, otherwise create a new App.Config file in the root folder of your application and add this settings therein.
N.B Set the Build Action property of the config file to Content and Copy To Output Directory property to Copy always so that the file is available when you build your project.
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal.MultiTarget"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<!-- PayPal SDK config -->
<paypal>
<settings>
<add name="mode" value="sandbox"/>
<add name="connectionTimeout" value="360000"/>
<add name="requestRetries" value="3"/>
<add name="clientId" value="AYrAaReQUybACfY3NJNZ1CNpbf8IdERKSHvA-urkP5G8YXzJd2khdkD8LT2WpDMUhXjn8NPl4sTFnYa2"/>
<add name="clientSecret" value="EObW1isFRDZKO6xe2FvpwABDdOsGrhrsKqMrWzSC4Ndz8k5WeYnpYofCm9EAdibSEBv5Gel6J86TzENj"/>
</settings>
</paypal>
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="PayPal.TestingLog.log"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="FileAppender"/>
</root>
</log4net>
<appSettings>
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger"/>
<add key="PayPalLogger.Delimiter" value="|" />
</appSettings>
Replace the clientId and clientSecret with your own keys from PayPal Developer Account and change the mode from sandbox to live when you everything is working for you and the application is ready to go into production.
- NET Framework 4.0
- NET Framework 4.5
- NET Framework 4.5.1
- NET Framework 4.6.1
- NET Framework 4.6.2
- NET Core 2.0
- NET Standard 2.0
This project was inspired by the Original .NET SDK by PayPal and majority of the credits should go to them. You can check out their repository for further insights.