The ASP.NET and Classic ASP SDKs for the SOAP APIThe SDK is composed of API Services, Encrypted Website Payments (EWP) Services, and user profiles that define characteristics of the users of those services. This section includes the following topics:This section details the software and hardware supported and required by the PayPal SDK, installation, and post-installation tasks.
Table C.1 The following table lists the minimum hardware requirements for using the PayPal SDK in development and testing. Production systems might require more capacity, depending on their expected load.
Table C.2 The latest version of the PayPal SDK is available at https://www.paypal.com/sdk. You can download either a self-extracting installation program or a ZIP file.The installation is straightforward and requires no special instruction. Installing the SDK source is optional.The SDK components are organized into different subdirectories, as shown in Table C.3, “PayPal SDK Directories and Contents.”
Table C.3 Compiled SDK DLLs and the SDK console (Console.exe) samples\ASPNET or ClassicASP Visual Studio project files and SDK source files. This folder is present only if you installed the source of the SDK.To uninstall the SDK, use the Microsoft Windows control panel Add/Remove Programs.The SDK comes with sample applications for your study and use. These samples can be installed in Microsoft Internet Information Server. For information, see “Sample Applications”.This section describes how to configure the SDK to work with the sample applications and programs you develop.Before developing applications with the SDK, be sure to add references in your ASP.NET projects to the SDK dynamic load libraries (DLLs) in SDK_root\bin.You can modify the PayPal ASP.NET and Classic ASP SDK behavior by making changes to the Web.config configuration file.To enable logging for your SDK-based web applications, the SDK must know the location of its Web.config file. In your Global.asa file, modify the Session_OnStart method to call the SDK’s COMAdapter.Init method:Set pp_caller = CreateObject("com.paypal.sdk.COMNetInterop.COMAdapter") pp_caller.Init Request.ServerVariables("APPL_PHYSICAL_PATH")You can add optional custom settings to the Web.config file.Immediately after the top-level <configuration> tag, you see a <configSections> tag. In <configSections>, add a <section name=”paypal”> tag, as shown below.The optional custom settings are in a <paypal> block later in the file:In the <paypal> block in Web.config, you can set the maximum number of retries to send SOAP requests.<maximumRetries value=”integerNumberOfRetries”/>A value of 0 for integerNumberOfRetries sends a SOAP request once, with no retries. The default setting is 0.The PayPal SDK uses log4net public domain logging software. For information about log4net, see the log4net documentation at http://logging.apache.org/log4net/release/manual/introduction.html.This section describes SDK logging levels, the configuration files in which you set the desired level, and SOAP request logging.
Table C.4 Same as DEBUG Full text of SOAP requests and responses and other debugging messages. DEBUG logging can degrade the performance of the SDK. Be careful about using it for day-to-day operation.
Note: Because SOAP requests and responses are asynchronous, the recording of requests and responses might appear out of sequence in the log file.To enable logging for your SDK-based web applications, add the following lines inside the <configuration> block of the Web.config file. You can copy these lines from the SDK_root\samples\ASPNET\Web.config or SDK_root\samples\ClassicASP\Web.config file.
l You can change the value of the file element to write log records to a specific location.
l Set the value of the level element to the desired detail described in Table C.4, “SDK Logging Levels.”To enable logging of the full text of SOAP requests and responses, add the following lines inside the <system.web> block of your Web.config file. You can copy these lines from the SDK_root\samples\ASPNET\Web.config or SDK_root\samples\ClassicASP\Web.config file.
IMPORTANT: DEBUG logging can degrade the performance of the SDK. Be careful about using it for day-to-day operation.If your application is behind a proxy server, you must enable proxy support in the Web.config file. For details on how to use the system.net element in the Web.config file, please refer to Configuring Internet Applications in the MSDN Library.Integrated access to the PayPal Web Services APIs is one of the main features of the PayPal SDK. As shown in Figure C.1, “PayPal SDK API Services: High-Level View”, the PayPal SDK uses the underlying platform’s SOAP toolkit to communicate with the PayPal API endpoint. Stub classes representing the requests, the responses, and their data are provided to set request parameters and read response values. These classes are auto-generated from the PayPal WSDL file.
Figure C.1 Complete Microsoft .NET Ndoc documentation for all PayPal SDK interfaces, classes, methods, structures, and data types are included with the SDK distribution. To view the documentation, open the following file with your web browser:SDK_root/docs/PayPalBaseAPI.chmBefore the SDK can be used, it must know the profile of the user accessing its services. A profile is a collection of information about a merchant or developer who uses the PayPal SDK. An API profile is associated with API Services and includes:
l If you are using API Certificates, the path to the API certificate in P12 format and the private key password to that certificate.
l The name of a third-party who authorizes the caller to invoke PayPal APIs on his behalf. This third-party is called a subject. This name is optional.
l
Table C.5 IAPIProfile interface This interface defines the basic information that PayPal needs to know about a user of the PayPal Web Service APIs. Developers must create an instance of IAPIProfile for each account that accesses the APIs. For single-merchant developers, only a single IAPIProfile instance is needed. PayPal provides a default implementation class called DefaultAPIProfile suitable for the needs of most SDK developers. However, can write a custom implementation if you need additional functionality the default class does not offer. ProfileFactory class This class creates IAPIProfile object. It contains static methods that handle the instantiation and construction of profile objects. This interface defines the basic information that PayPal needs to know about a user of PayPal’s Encrypted Website Payments (EWP) service. Developers must create an instance of EWPProfile for each account that generates the encrypted button code for single-merchant users. This will be just be a single instance. PayPal provides a basic implementation class called DefaultEWPProfile suitable for the needs of most SDK developers. However, you can write a custom implementation if you need functionality the default class does not offer.
l
l These classes are in the com.paypal.sdk.COMNetInterop namespace. For examples of them in use, see the source code in SDK_Root\Samples\ClassicASP.The COMAdapter2 class includes methods for setting and retrieving the values associated with an API profile, including the API username and password, the API signature, the third-party subject and the environment. It also includes methods for making API calls.For example, the following code snippet sets the API Profile to the credentials of the sample user supplied with the PayPal SDK, as described in “Sample Applications”.” This sample user relies on an API certificate:The following code snippet sets the API Profile to the credentials of a user who relies on an API signature:pp_caller.SetAPISignature "A0iFR8ojMS.TH8Eyc3t0CP1dTJzbA.cDbvQAR0GPJVEuvtDzkiPJNKj7"The COMArray proxy class functions similarly to the .NET ArrayList class. Use COMArray when you need to create a .NET array when you are setting up the request object; for example, when you provide multiple PaymentDetailsType items to a DoDirectPayment request.Set pmtDetailsItemArray = CreateObject("com.paypal.sdk.COMNetInterop.COMArray")Set pmtDetailsItem1 = CreateObject("com.paypal.soap.api.PaymentDetailsItemType")Set paymentDetailsType = CreateObject("com.paypal.soap.api.PaymentDetailsType")For example, suppose you want to specify US Dollars as the Currency type in a DoDirectPayment call. Without the COMUtil class, you would need to specify the integer value of the enumeration with code such as the following:The PayPal SDK includes sample applications in the SDK_root\samples\ASPNET or SDK_root\samples\ClassicASP folder. The samples are divided into subfolders by products.
Table C.6 Subfolder in SDK_Root\samples\ASPNET or ClassicASP
l The samples come with an API Signature for use with the SDK and the PayPal Sandbox. This API Signature belongs to the following user:
Table C.7 A‑IzJhZZjhg29XQ2qnhapuwxIDzyAZQ92FRP5dqBzVesOkzbdUONzmOUThe samples come with a PayPal Web Services API digital certificate for use with the SDK and the PayPal Sandbox. This certificate belongs to the following user:
SDK_root\samples\Certs\sdk-seller.p12
Note: Be sure that you are logged in as an administrator, that IIS running, and that WinHttpCertCfg.exe is in your PATH.SDK_root\samples\ASPNET\InstallSample.bat.SDK_root\samples\ClassicASP\InstallSample.bat.
2. For ASP.NET To enable logging, change the permissions on the localComputerName\ASPNET folder to Full Control.For Classic ASP: To enable logging, for the user account that has anonymous access, change the permissions on the logs folder to Full Control. By default, this folder is named IUSER_localComputerName.InstallSample.bat does the following:
– Creates a virtual directory named PaypalASPNETSample or PaypalClassicASPSample in IIS that points to SDK_root\samples\ASPNET or ClassicASP.
– Loads the sample API certificate SDK_root\samples\Certs\sdk-seller.p12 into the Microsoft Windows system store.
– Uses the WinHttpCertCfg.exe command to grant unlimited access for account Everyone to that certificate .