-
Notifications
You must be signed in to change notification settings - Fork 461
Configuration
In order to use the PayPal .NET SDK with your application, you will need to first configure your application. By default, the SDK will attempt to look for PayPal-specific settings in your application's web.config or app.config file.
The following is a sample config file containing the configuration sections that are required in order for the settings to be used with this SDK:
<configuration>
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<!-- PayPal SDK settings -->
<paypal>
<settings>
<add name="mode" value="sandbox" />
<add name="clientId" value="__CLIENT_ID__" />
<add name="clientSecret" value="__CLIENT_SECRET__" />
</settings>
</paypal>
</configuration>
The following table defines the currently supported settings that can be specified in the <paypal>
section:
Settings Name | Description | Default |
---|---|---|
mode |
Determines which PayPal endpoint URL will be used with your application. Possible values are live or sandbox . |
sandbox |
clientId |
Your application's Client ID as specified on your PayPal account's My REST Apps page for your specific application. | none |
clientSecret |
Your application's Client Secret as specified on your PayPal account's My REST Apps page for your specific application. | none |
requestRetries |
The number of times HTTP requests should be attempted by the SDK before an error is thrown. | 3 |
connectionTimeout |
The amount of time (in milliseconds) before an HTTP request should timeout. | 30000 |
webhook.id |
Specifies the webhook ID to use when validating received webhook events. | none |
webhook.trustCert |
Specifies the trusted root certificate to use when validating the certificate provided by a received webhook event. | SDK comes bundled with a PayPal trusted root certificate. |
endpoint |
Overrides the default REST endpoint URL as well as mode , if set. |
SDK-defined |
oauth.EndPoint |
Overrides the default endpoint URL used for gettings OAuth tokens. | Uses endpoint |
proxyAddress |
The address for a proxy server your application must tunnel through in order to connect with PayPal. | none |
proxyCredentials |
If proxyAddress is set, use this field to specify the username and password for the proxy server. The format must be username:password.
|
none |
The SDK comes with built-in support for logging using log4net if you choose to include it as a reference in your application.
In order to enable logging with the SDK, add the following configuration information to your config file along with the PayPal config information in the previous section:
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<!-- log4net settings -->
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="my_app.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>
<!--
App-specific settings. Here we specify which PayPal logging classes are enabled.
PayPal.Log.Log4netLogger: Provides base log4net logging functionality
PayPal.Log.DiagnosticsLogger: Provides more thorough logging of system diagnostic information and tracing code execution
-->
<appSettings>
<!-- Diagnostics logging is only available in a Full Trust environment. -->
<!-- <add key="PayPalLogger" value="PayPal.Log.DiagnosticsLogger, PayPal.Log.Log4netLogger"/> -->
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger"/>
</appSettings>
</configuration>
Home | Installation | Make Your First Call | Samples | FAQ | Report Issues
Getting Started
Using the PayPal .NET SDK
Extras
Links