Checkout and Order Processing for an Ecommerce Website
It's vital for an ecommerce website to get the checkout and ordering process correct. This five-part article series shows you how to use Ruby-on-Rails to manage it with very little difficulty. It's excerpted from chapter nine of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).
Checkout and Order Processing for an Ecommerce Website (Page 1 of 4 )
In this chapter, we’ll implement a checkout page and an order-processing system for the Emporium site. This involves integrating with payment gateways, which George uses for handling the transactions.
We’ll show you how to integrate with two popular payment gateways: PayPal and Authorize.Net using two separate frameworks: the Active Merchant plugin and the Payment gem. These two libraries have already implemented the toughest part of the integration with the payment gateway. All we need to do is implement the front-end for the user stories and use the libraries to communicate with the payment gateways.
Towards the end of the chapter, we’ll explain how to use the Shipping gem to calculate shipping costs. Lastly, we’ll briefly discuss how taxes are calculated.
Getting the Checkout and Order-Processing Requirements
For this sprint, we have four user stories to implement:
Check out:Jill, Emporium’s beloved customer, has found two new books that she wants to buy, and has placed them in the shopping cart. The next step for her to continue with the order is to go to the checkout page. Here, she can type in her contact information, the shipping address, and credit card information, and then place the order by submitting the information. This initiates the order-processing workflow that involves billing the customer and shipping the books.
View orders: George needs to be able to view the status of all orders, such as processed orders and closed ones. Processed orders are the ones that have been billed to the customer but have not been shipped yet. Closed orders are the ones that George has sent to the customer.
View order: Before George can ship anything anywhere, he must be able to view the details of the order. We will add a page that shows the shipping address and billing information, along with the contact information for the customer.
Close order: After George has shipped the books, he should close the order. We will set this up on the order details page, so George can simply click a button that sets the order status to closed.
Let’s start by implementing the Check Out user story.