SaaS CMS has officially launched! Learn more now.

PayPal Payment Provider - Installation and User Guide

Product version:

EPiServer Commerce 1 R2 SP2

Document last saved:

Table of Contents


This document describes how to install and use the PayPal Payment Module for EPiServer Commerce with the Enoteca sample templates. The module is available for EPiServer Commerce 1 R2 SP2, and integrates the PayPal checkout payment provider with EPiServer Commerce.

Files in the PayPal Payment Provider Project

The following files are included in the project package:

  • Paypal_base.dll (library dll from
  • PayPalPayment_EN.xml (lang file)
  • CanadianOrUSstates.txt (resource file)
  • ISOCodes.txt (resource file)
  • ConfigurePayment.ascx (and its ascx.cs, ascx.designer.cs file)
  • EditTab.ascx (and its ascx.cs, ascx.designer.cs file)
  • PaymentMethod.ascx (and its ascx.cs, ascx.designer.cs file)
  • PayPal.css
  • PayPal.aspx (and its ascx.cs, ascx.designer.cs file)
  • PayPalRedirect.aspx (and its ascx.cs, ascx.designer.cs file)
  • PayPalPaymentLanding.aspx (and its aspx.cs, aspx.designer.cs file)
  • PayPalPaymentGateway.cs (main payment gateway business)
  • Utilities.cs (contains helper functions)

Deploying the PayPal Payment Provider Files

Downloading the PayPal package will provide you with an EPiServer.Business.Commerce.Payment.PayPal project. Follow these steps to deploy the PayPal Payment Provider to your solution:

  • Deploy PaymentMethod.ascx, PfayPal.css, ISOCodes.txt, CanadianOrUSstates.txt to the folder "[~EnotecaSite]\Templates\Enoteca\Units\Placeable\Plugins\Payment\PayPal" of your website. Create the "PayPal" folder if it does not exist, but do not include them in the EPiServer Enoteca Project.
  • Deploy the file ConfigurePayment.ascx to the "[~CommerceManagerFrameworkSite]\Shared\Apps\Order\Payments\Plugins\PayPal". Create the "PayPal" folder if it does not exist (for instance C:\EPiServer\eCommerceFramework\5.2\EnotecaCM\Shared\Apps\Order\Payments\Plugins\PayPal).
  • Deploy the file EditTab.ascx to the "[~CommerceManagerFrameworkSite]\Shared\Apps\Order\Payments\MetaData\PayPal". Create the "PayPal" folder if it does not exist. (for instance  C:\EPiServer\eCommerceFramework\5.2\WineStoreCM\Shared\Apps\Order\Payments\MetaData\PayPal).
  • Deploy the file PayPal_EN.xml to the “lang” folder of the EnotecaSite.
  • Deploy the file PayPal.aspx, PayPalRedirect.aspx, PayPalPaymentLanding.aspx to the folders "[EnotecaSite]/Templates/Commerce/Pages/", but do not include them in the EPiServer Enoteca Project.
  • The PayPal package includes the following DLLs which are necessary to build the project:
    - EPiServer.dll
    - EPiServer.BaseLibrary.dll
    - EPiServer.Business.Commerce.dll
    - EPiServer.Data.dll
    - log4net.dll
    - Mediachase.BusinessFoundation.dll
    - Mediachase.BusinessFoundation.Data.dll
    - Mediachase.Commerce.dll
    - Mediachase.Commerce.Plugins.Payment.dll
    - Mediachase.Commerce.Website.dll
    - Mediachase.DataProvider.dll
    - Mediachase.MetaDataPlus.dll
    - Mediachase.WebConsoleLib.dll
    - paypal_base.dll
  • You should modify the references to the PayPal project, instead redirect them to your Enoteca website DLLs to avoid DLL version mismatch or missing references.
  • Rebuild the PayPal project, and you will now have an EPiServer.Business.Commerce.Payment.PayPal.dll.
  • Deploy Paypal_base.dll and EPiServer.Business.Commerce.Payment.PayPal.dll to the "bin" folder of your CommerceManagerSite. (for instance C:\EPiServer\Sites\winestore\bin).
  • Deploy Paypal_base.dll and EPiServer.Business.Commerce.Payment.PayPal.dll to the "bin" folder of your Enoteca website. (for instance C:\EPiServer\Sites\winestoreCM\bin).

Configuring the IPN Service for the Enoteca Project

This step is needed in order for the PayPal Payment module to work properly. When the buyer approves the payment with PayPal, the IPN service will update the status of the order. If “Authorization” payment action is selected, the order will change status from “New Order” to “Processing” if authorized properly.

If the payment is under review for risk or has some other pending hold reason from PayPal, it will change status to “Submitted”. If the “Sale” payment action is selected, the order will change to “Shipped” if the payment was successful. Otherwise it will change to “Submitted”. The IPN service uses log4net to log various messages from PayPal for administrators to be able to update the status of an order.

After deploying the project files according to either of the methods above, do the following to set up the IPN service:

  1. Create a page type (for example [Commerce] PayPal) for the IPN service. This page type points to the PayPal.aspx template which you deployed to your website earlier (/Templates/Enoteca/Pages/PayPal.aspx). This page type does not need any property.
  2. Create an EPiServer CMS page from the [Commerce] PayPal page type.
  3. Add a property named exactly PayPalPaymentPage of type Page to the Start page page type.
  4. Edit the property PayPalPaymentPage on the Start page. Set the page link of the created page (in Step 2) to the property's value.


Configuring PayPal in Commerce Manager

After deploying all necessary files, open the EPiServer Commerce Manager back-end site and do the following:

  1. Go to Administration/Order System/Payments/English (United States), the last option is the language in which you chose to make the PayPal payment to be available in.
  2. Select Create new payment method. The System keyword option must be “PayPal” (the name of the folder of created during deployment). Class Name must be EPiServer.Business.Commerce.Payment.PayPal.PayPalPaymentGateway.
  3. When you click OK, the new payment method will be saved with a specific ID.
  4. Open the payment method for editing again, go to the Parameters tab and enter the following:

    - Business email: The main email that you registered with PayPal.
    - API Username: The API user name PayPal will give you when the use registers to use PayPal’s API calls.
    - Password: Your PayPal’s API user password.
    - API Signature: Your PayPal’s API signature.
    - Use test environment (sandbox): Specify here if this is a testing settings or not (sandbox environment or live environment).
    - Allow buyers to change shipping address at PayPal: Defines whether to allow buyers to change their shipping address when reviewing their PayPal payment.
    - Payment action: The payment action buyers will perform at PayPal. Default is Authorization where a payment is authorized only, not yet captured. With the Sale option, the payment will be immediately transferred from buyer’s account to merchant’s account.
    - Allow guest checkout: Allows buyers who doesn’t have a PayPal account to perform a payment. If allowed, buyers will see a billing page from which they can pay using a credit card without having to login to PayPal. If not allowed, the buyer will see a login page when redirected to PayPal.
    - ExpressCheckout URL: The URL to redirect a user to PayPal when the SetExpressCheckout API call is successful. NOTE this URL should change according to the Use test environment option.
    - Skip Order Confirm page: Lets buyers go directly to PayPal after selecting PayPal as payment method. Otherwise buyers will see an order confirmation page before being redirected to the PayPal. By default the buyers will not see the order confirmation page.
    - PayPal Secure Merchant Account ID (PAL) (optional): Used to create the dynamic PayPal mark image on the payment selection page. If nothing is entered here, an API call will be made to PayPal to get it.

Configuring the PayPal HashKey (Optional)

The communication with PayPal uses a private hash key to ensure security in the communication. This private hash key will be used to create secure hash keys, which appends to an accept URL and a cancel URL. The information about accept URL and cancel URL is sent to PayPal using HTTPS, so these keys will not be exposed.

When PayPal redirects a user to those URLs, the keys are used to verify that the request comes from PayPal only, since only PayPal knows about the keys.

You can configure this hash key in the application settings configuration section under the key “PayPalHashKey”.

Using the PayPal Payment Provider Module

When you have deployed the files and configured the PayPal Payment module on your EPiServer Commerce website, you should have a PayPal option in your checkout procedure:

  1. Select the PayPal payment method on the Payment Options page during check out.
  2. When you click the Continue/Place Order button on the order confirmation page, you will be redirected to to approve the payment.
  3. You can see the shipping and billing addresses entered during the checkout procedure, during which these addresses can be changed.
  4. When you have finalized the approval process, you will be redirected to the “Thank You” (landing) page of the Enoteca site.

NOTE will check the address (billing and shipping) very carefully. If you use a US address to test, use the correct and complete one with ZIP code, State, and City, otherwise the precheck with PayPal API will fail and you cannot complete the payment. In the Enoteca sample templates, the State is the County field when editing and address (Alaska in the image image).