Setting Up the Paypal PayflowPro Credit Card Provider
This guide specifically shows how you can implement PayflowPro in ECF in less than two hours. This guide also provides general tips which will help in implementing any custom payment gateway.
1. Download the following projects, PaypalProvider and PaypalConfiguration from this zip : PayPalProvider.zip
2. Include them in your solution.
3. Get a trial version of the nSoftware at http://www.nsoftware.com/download/paypal.aspx
- You will eventually need to pay for a license, which costs approximately $400 for this third-party software.
4. Fix any reference issues with the new psmurojects. You will need to point to your own ecf/nsoftware dlls:
For PaypalConfiguration project:
- Mediachase.Commerce
- Mediachase.Commerce.Plugins.Payment
- Mediachase.Commerce.Website (WebUtility project)
- Mediachase.MetaDataPlus
- Mediachase.WebConsoleLib
- reference to the PaypalProvider project
For the PaypalProvider project:
- Mediachase.Commerce
- Mediachase.Commerce.Plugins.Payment
- Mediachase.MetaDataPlus
- nsoftware.InPayPal
- nsoftware.InpayPal.System
6. Add a reference to both of the new projects to the admin and front end interfaces.
7. Create a new folder in the admin project Apps/Order/Payments/Plugins/ folder called "PayPal".
8. Copy the ConfigurePayment.ascx from the admin folder of the PaypalConfiguration project (and *not* the corresponding .ascx.cs and .cs.designer files) into this new folder. This will provide the admin configuration for Paypal instances.
9. Create a new folder in the front end project in the [Theme]/BusinessControls/CheckoutControls/plugins/payment called "PayPal".
10. Copy the PaymentMethod.ascx file into this new folder. This creates a place in the checkout process to enter information about a credit that will be processed by the paypal provider.
| Step 10 assumes you are using the checkout design or at least the payment provider method used in the default site provided by Mediachase to access the ECF API and checkout workflows. Most developers will create their own custom checkout. In this case, the important thing to know is that its simple purpose is to collect credit card information and provide it back to the checkout process to add a payment to the Cart instance. When you are creating your own checkout and adding the functionality where payments are added to the cart, the Payment instance has two fields relating to your Paypal payment method that need to be set based on back end configuration: PaymentMethodId and PaymentMethodName. The first is the PaymentMethodId from the PaymentMethod db table that corresponds to the PayPal provider. The second is the SystemKeyword field from the same table row. This information can be retrieved using the Mediachase.Commerce.Orders.Managers.PaymentManager object. See an example of these approaches in the following two places in the B2CSampleSite SDK site:
/Templates/Everything/BusinessControls/CheckoutControls/CheckoutPaymentModule.ascx.cs, OnInit method |
11. Compile the solution.
12. Open the Commerce Manager instance for this code base.
13. Goto Administration/Order System/Payments/Language.
14. Click New for Payment Methods.
15. Specify the following properties and then press OK:
- Name: whatever you want to set. It can be used to show the name of the provider in the front end if you want.
- System Keywork: PayPal
- Class Name: dxPaymentProviders.PayPalProvider
- Payment Class: Mediachase.Commerce.Orders.CreditCardPayment
- IsActive: Yes
You can leave the rest of the settings to their default values.
16. If you are using the checkout wizard provided in the B2CSampleSite, you will now see the paypal provider as a payment option during checkout. However, you will not be able to complete a checkout with a PayPal payment because the PayPal account configuration is not done yet.
17. For testing purpose, you will need to setup a PayPal test account. The directions for this are provided at nSoftware.http://www.nsoftware.com/kb/showentry.aspx?entry=04010501
These directions I found a slightly out of date with the revised Paypal interface/options. So here are some additional tips:
Test Your Implementation
The PayPal Test Environment is located here: https://developer.paypal.com/us/cgi-bin/devscr?cmd=_sandbox-acct-session
Make sure to setup the account as a PayPal Pro account and note the following:
- Verify the email
- Verify the account
- Add a credit card to the test acount for testing
- API URLs http://www.nsoftware.com/kb/showentry.aspx?entry=06250701https://api-3t.sandbox.paypal.com/nvp
- For testing, you will need to create a test credit card you can make transactions with. The Paypal provider will not let you use any credit card number when submitting a test transaction.
Directions for Setting Up a Test Credit Card:
- Log in to your Sandbox Account
- Click Profile
- Click on Credit Cards under Financial Information
- Click the Add button, as if you are adding a credit card to the account
Use the credit card number that is automatically generated here as the credit card of your buyer
| Do not click on the Add Card button as this will add the credit card to your Sandbox account. If it is added to your Sandbox account, it cannot be used to make a non-PayPal account payment. |
| A list of error codes relating to the PayPal provider transaction can be found here:https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_errorcodes |
Test Within Commerce Manager
Once you have setup your test environment and test credit card, go back to Commerce Manager and re-open the new payment method you created earlier.
Go to the Parameters tab and provide the ID and signature created with your test Paypal account. For the Processing URL, specify https://api-3t.sandbox.paypal.com/nvp
Once you press OK, you are are successfully setup and you should be able to begin submitting test Paypal transactions.
Additional Resources
Here is dditional reading to better understand payment providers in ECF:
- http://docs.mediachase.com/display/ecf52devguide/Creating+Payment+Gateways
- http://docs.mediachase.com/display/ECFG52CommerceGuide/Payment+Gateways
| This Paypal provider is setup to only handle the US. This is only because the country code in ECF does not match the ISO 3166 code list used by Paypal. The class PayPalCountryCodeLookup in the Paypal provider provided above allows you to easily map the country codes you would like to be able to use. The ECF country codes can be found in the Country table. A lookup reference for the ISO 3166 country codes can be found here:http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm |