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.
- Get a PayPal business or premier account.
- Apply for Website Payments Pro and get approved.
- Setup a Paypal developer account and sandbox accounts
- Get the necessary API access and certificates
- Download the ELC RoR::Paypal Plugin
- Download soap4r and http-access2
- Install the plugin
- Setup the plugin and certificates
- 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:
- You need to use the Nov 2005 version of soap4r to generate the wsdl and to send the request to paypal
- 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.
- 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:
- “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).
- Authentication Error - Not using the right username / password from the API Credentials
- SSL Not Supported - You need to install http-access2