.NET Class Library for PayPal™ SOAP API
The download includes the PayPal SOAP API class library .dll file to reference in your project, as well as a Visual Studio project for this complete demo site.
To run this demo on your local machine, unzip the download and open the Visual Studio solution in the PayPalSoapMvcDemo folder.
In your project, add a reference to the "Encore.PayPal.Soap.dll" file.
Add the "encore.PayPal.Soap" config section to your web.config file, and set the environment, username, password, and signature attributes. Here is an example:
<configuration> <configSections> <section name="encore.PayPal.Soap" type="Encore.PayPal.Soap.Configuration, Encore.PayPal.Soap" requirePermission="false"/> </configSections> <encore.PayPal.Soap environment="(Live or Sandbox)" username="(Your PayPal API username)" password="(Your PayPal API password)" signature="(Your PayPal API signature)"> </encore.PayPal.Soap> ...
Here is a complete list of optional configuration properties. They are already defaulted to the values shown here, and it is neither necessary, nor recommended to include them unless you need to override the default.
<encore.PayPal.Soap environment="Live" version="124.0" api3tURL="https://api-3t.paypal.com/2.0/" apiaaURL="https://api.paypal.com/2.0/" paypalURL="https://www.paypal.com/" delegateClass="" delegateMethod="" useCertificate="false" useEncryption="false" encryptionKey="" userName="" password="" signature="" subject="" keyPassword="" certificate="" country="US" currency="USD" locale="US" disableGlobalization="false" returnFMFDetails="false" shippingMethod="Download" timeout="30"> </encore.PayPal.Soap>
Verify that your project is targeting .NET 4.5.1 or later. Upgrade the project if necessary.
Remove the projet reference to the old "Encore.PayPal.Soap.dll" file, and add a reference to the new "Encore.PayPal.Soap.dll" file.
Remove the "licensedTo" and "licenseKey" attributes from the "encore.PayPal.Soap" section of your web.config file. A license is no longer required for this library.
API request properties like ReturnPage and CancelPage used in Express Checkout have been renamed to ReturnUrl and CancelUrl to better reflect their compatibility with MVC as well as Web Forms. You must change your code accordingly.
This means that Website Payments Pro is not enabled for your account. You need to accept the billing agreement, or contact PayPal customer service to have your account configured correctly.
This means something is incorrect with your API credentials. Usually this is because you are attempting to use Live credentials in the Sandbox, or Sandbox credentials in the Live environment.
It could be an invalid password or signature (make sure there are no extra spaces if you copy/pasted from your PayPal account page).
SoapAddressVerify returns the status of a PayPal account address, including street and zip code match results. (requires special permission)
SoapBillingAgreementUpdate updates or deletes a billing agreement.
SoapBillOutstandingAmount bills any balance due on a recurring payments profile.
SoapCreateBillingAgreement returns a billing agreement ID that may be used to make reference transactions against a PayPal account. (undocumented, needs special permission)
SoapCreateRecurringPaymentsProfile creates a recurring payments profile allowing automatic periodic billing.
SoapDoAuthorization is your request to authorize a customer order that can be fulfilled within 29 days.
SoapDoCapture is your request to completely or partially settle an order, an authorization, or reauthorization.
SoapDoDirectPayment charges or authorizes a credit card.
SoapDoExpressCheckoutPayment obtains payment through Express Checkout for a final sale or requests authorization for later capture of payment.
SoapDoNonReferencedCredit makes a non-referenced credit to a customer’s credit card.
SoapDoReauthorization reauthorizes a previously authorized a transaction and that has passed its settlement period.
SoapDoReferenceTransaction makes a payment based on the information provided in a previous Direct Payment, avoiding the need to provide any buyer information.
SoapDoVoid voids an order or an authorization.
SoapGetBalance returns the PayPal account balance of the account whose API credentials are used for the call.
SoapGetBillingAgreementCustomerDetails returns information about the customer, including name and address on file with PayPal.
SoapGetExpressCheckoutDetails returns information about the customer, including name and address on file with PayPal.
SoapGetRecurringPaymentsProfileDetailsreturns the details of a recurring payments profile.
SoapGetTransactionDetails gets details about a transaction.
SoapManagePendingTransactionStatus accepts or denies a pending transaction. (undocumented, untested, needs special permission)
SoapManageRecurringPaymentsProfileStatus allows a recurring payment profile to be cancelled, suspended, or reactivated.
SoapMassPay processes payments en masse to up to 250 different recipients.
SoapRefundTransaction refunds a payment.
SoapSetCustomerBillingAgreement indicates to PayPal that you are using Express Checkout to create billing agreements for your customer.
SoapSetExpressCheckout indicates to PayPal that you are using Express Checkout to obtain payment from your customer.
SoapTransactionSearch searches transaction history.
SoapUpdateRecurringPaymentsProfile allows modification of the terms of a recurring payments profile.
Special Classes, Constants, and Binding Sources are provided to simplify building your payment solution.
SoapCredentialsDelegate The developer can define a function that takes no parameters and has return type SoapCredentials, and then pass that function to any API call instead of setting credentials individually. This can increase security by passing the API credentials from an encrypted store of the developer’s choice. The delegate function may also be declared in the application’s configuration file to make this a global setting.
SoapConfig is a static class that returns all properties defined in the encore.PayPal.Soap configuration section of the application’s configuration file. Default values are returned for any property not set in the configuration file.
SoapGetTransactionDetailsResponse.BindingSource returns a single transaction details record in the form of a Collection that allows binding directly as the data source for a FormView or DetailsView object.
SoapMonthCodeType encapsulates a list of calendar month constants, including integer value, short name, and long name. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapYearCodeType encapsulates a list of calendar year constants from the current year through current year plus eleven. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapStateCodeType encapsulates a list of states and provinces, including name and two-character code. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapCountryCodeType encapsulates a list of countries, including name and two-character code. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapLocaleCodeType encapsulates a list of countries for which PayPal Express Checkout pages include culture settings. Includes name and two-character code, a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapCreditCardTypeType encapsulates a list of credit card types accepted by PayPal. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
SoapCurrencyCodeType encapsulates a list of currencies accepted by PayPal, including name and three-character code. Includes a BindingSource property to allow binding directly to DropDownList objects, and a Get() member to allow binding to an ObjectDataSource.
TraceExtension class captures the XML envelopes that comprise the raw API request and response data. This allows the developer to see exactly what data is sent to and received from the API – invaluable for troubleshooting.