Interchange
PayPal Pro Payments Module
Overview
PayPal’s Website Payments Pro solution offers an alternative to traditional credit card transaction processing, coupled with the ability to accept PayPal payments using the “Express Checkout” feature.
Prerequisites
- SOAP::Lite
- PayPal Developer Account (sandbox)
- Full rights to the Interchange installation and configuration directories
Integrating with Interchange
Normal credit card transactions (Visa, Mastercard, Amex, and Discover) can be accomplished with the PaypalPro.pm PERL payment module installed in the Interchange lib/Vend/Payment directory.
Express checkout transactions must be used with normal card processing as part of the PayPal merchant agreement (see the PayPal Integration guide for rules on placement and operation). This is treated as a separate payment method, with its own unique entry in order.profile. The UserTag paypal_api.tag communicates with the PayPal API to set the transaction parameters and read responses. The file payment.html can be used for this.
Configuration & Testing
- Download the files (at left) and install PaypalPro.pm in lib/Vend/Payment directory, and paypal_api.tag in the global usertag directory.
- Reqest a PayPal certificate, if you have not already. Also, under “Website Payment Preferences” for your PayPal account, ensure the contact telephone number is required.
- Copy the PayPal SSL certificates into a directory readable by the user that runs Interchange, such as /var/lib/interchange
- Edit the interchange.cfg file, adding the line:
Require module Vend::Payment::PaypalPro - Edit the catalog.cfg file, adding the following (set
sandboxandPAYPAL_TESTto 1 for testing with the sandbox and of course use your assigned API username and password):Route paypalpro user "test_api1.testdomain.com" Route paypalpro secret "password" Route paypalpro keyfile "/var/lib/interchange/paypal_cert.pem" Route paypalpro sandbox 1 Variable PAYPAL_KEY /var/lib/interchange/paypal_cert.pem Variable PAYPAL_USER test_api1.testdomain.com Variable PAYPAL_PASS password Variable PAYPAL_TEST 1
- Setup an order profile in etc/profiles.order as follows:
__NAME__ paypal __COMMON_ORDER_PROFILE__ &fatal = yes email=required email=email &set = prof_mode_accepted [var PAYPAL_ACCEPTED] prof_mode_accepted=required This site doesn't accept paypal orders. [cgi set="" name=no_paypal_token] [if !scratch paypal_token] no_paypal_token=mandatory Please login to PayPal using the Login button. [/if] &set=mv_payment PayPal ID [scratch paypal_payerid] &final = yes &setcheck=mv_email [value email] __END__
- Edit etc/log_transaction for some processing for the paypal order profile:
[elsif value mv_order_profile eq paypal] [tmp paypal_ec_result][paypal_api token="[scratch paypal_token]" action="dorequest" invoiceid="[value mv_order_number]"][/tmp] [if scratch paypal_ec_result] [set paypal_token][/paypal_token] [else] PayPal transaction FAILED. [calc] die errmsg( "PayPal charge could not be completed. %sn", errmsg($Session->{payment_error}), ); [/calc] [/else] [/if] [/elsif] - Copy the payment.html file into the pages/ord directory and edit settings as needed. Add the “paypal” payment option to the checkout page.
- Foundation-based stores will need to change the global variable MV_PAYMENT_MODE to paypalpro
- Test using the PayPal sandbox.
August 24, 2007 at 1:54 pm
I’m receiving errors when attempting to download the Paypalpro.pm, paypal_api.tag, and payment.html files mentioned in this article.