My Octopress Blog

A blogging framework for hackers.

Using Paypal Website Payments Pro With Ruby on Rails

Using Paypal Website Payments Pro with Ruby On Rails

There have been a few tutorials written on using PayPal’s API with RubyOnRails. There have been plugins made and patches to ActiveMerchant developed. Still, I could not for the life of me get it working for the longest time. This is my walkthrough.. it’s the idiot’s walkthrough. I assume nothing about your knowledge, and I will explain it in a detailed step by step process.

Here are the steps required to using PayPal’s Website Payments Pro. Also note that at this time Website Payments Pro is ONLY available to US merchants.

  1. Get a PayPal business or premier account.
  2. Apply for Website Payments Pro and get approved.
  3. Setup a Paypal developer account and sandbox accounts
  4. Get the necessary API access and certificates
  5. Download the ELC RoR::Paypal Plugin
  6. Download soap4r and http-access2
  7. Install the plugin
  8. Setup the plugin and certificates
  9. Run the tests

If you’ve already done most of this and you’re just looking for answers to the hard questions, here they are for reference:

  1. You need to use the Nov 2005 version of soap4r to generate the wsdl and to send the request to paypal
  2. Your Username and Password for using the API is NOT your Paypal login info. It is the username and password provided for you when you generate the API Certificate.
  3. Paypal’s Country Codes are the TWO character international standards. CA, US, DE, JP etc

Here are some common issues we hit and what they mean:

  1. “OrderTotal is required” - You are using an old version of the default.rb and defaultDriver.rb files. You need to regenerate them with the Nov 2005 version of soap4r (or newer).
  2. Authentication Error - Not using the right username / password from the API Credentials
  3. SSL Not Supported - You need to install http-access2