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

  1. Download the files (at left) and install PaypalPro.pm in lib/Vend/Payment directory, and paypal_api.tag in the global usertag directory.
  2. 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.
  3. Copy the PayPal SSL certificates into a directory readable by the user that runs Interchange, such as /var/lib/interchange
  4. Edit the interchange.cfg file, adding the line:
    Require module Vend::Payment::PaypalPro
  5. Edit the catalog.cfg file, adding the following (set sandbox and PAYPAL_TEST to 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
  6. 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__
  7. 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]
  8. Copy the payment.html file into the pages/ord directory and edit settings as needed. Add the “paypal” payment option to the checkout page.
  9. Foundation-based stores will need to change the global variable MV_PAYMENT_MODE to paypalpro
  10. Test using the PayPal sandbox.

3 Responses to “PayPal Interchange Module”


  1. 1 Bill 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.

  2. 2 enlilmeta December 11, 2009 at 5:45 pm

    Lots of folks write about this topic but you said some true words.

  3. 3 www.rebelmouse.com February 12, 2014 at 11:49 pm

    It’s appropriate time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I want to suggest you some interesting things or advice.
    Perhaps you can write next articles referring to this
    article. I wish to read even more things about it!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Topics


%d bloggers like this: