In this third part of a five-part series on building the checkout and order processing components of an ecommerce website with Ruby-on-Rails, we'll focus on integrating PayPal into the application's capabilities. This article is excerpted from chapter nine of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).
Online Order Processing: Using PayPal (Page 1 of 4 )
Integrating with PayPal
To be able to test PayPal, you will first need to sign up for an account at PayPal Developer Central (https://developer.paypal.com/). After you log in, you are greeted with the page shown in Figure 9-5.
Figure 9-5. The PayPal Developer Central homepage
Along with links to the forums and help references, PayPal Developer Central provides access to three important areas:
Sandbox: This is where you can create dummy bank accounts and credit cards that you can use for testing transactions without actually billing anyone.
Test Certificates: This is where you can download the test certificate, which you’ll need when communicating with PayPal over a secure SSL connection.
Email: This page is where all e-mail messages that PayPal sends end up. Instead of sending them to your real account, PayPal simply stores them on its servers and displays them on this page.
Using PayPal Developer Central, we will first create a business account and credit card in the Sandbox. This will include steps for verifying and confirming the account. Then we will set up the API credentials that Active Merchant needs when communicating with PayPal, by creating a private key and certificate. Finally, we can return to our application and implement the integration with the payment gateway.