Tuesday, September 09, 2008

Integrate ActiveMerchant With Rails

I read the Integrate ActiveMerchant With Rails recipe in the book Enterprise Rails Recipes by Maik Schmidt. This recipe is basically a recipe for disaster.

In a real web application the user must be taken out of the loop as soon as possible. Having a spinner spining or disabling the button or saying don't click the button is a bad design. Take Amazon for instance the user experience on the site is a good example to follow.

As soon as you create an order, you must set it's initial state and process that order in the background. You can use run rake task using a CRON job that processes the orders. What happens if the Gateway is down? What will you recover from network errors? These things happen in the real world and your software that affect the bottom line must be able to handle it.

4 comments:

  1. Bala:

    I think you've missed the recipe's point. It is about integrating ActiveMerchant with Rails, that is it explains the basics of the plugin, how to configure it, and how to use it to communicate with a payment gateway. At the beginning of the recipe I even make very clear that it does not contain a real-world application.

    There are several important things that are not shown in this recipe but can be found in others. For example, I do not explain how to encrypt the credentials used to connect to the payment gateway (see "Protect Information with Symmetric Ciphers" to learn more about it) nor do I show how to process orders asynchronously (see "Connect to Message Queues with ActiveMessaging" to learn more about it).

    All the things you are missing can be found in the book, but for the reader's convenience I've decided to not explain all of them in a single recipe.

    Maik

    ReplyDelete
  2. Bala,

    You're asking for this one recipe to encompass everything you need to know to write an ecommerce site. That's not the intent of the recipe at all. There are entire books dedicated to that topic.

    I think the author was just trying to provide a little context around the main idea of the recipe, which is how to use ActiveMerchant. And I think it does that quite well.

    ReplyDelete
  3. Anonymous2:01 AM

    A payment gateway facilitates the transfer of information between a payment portal and the front-end processor or acquiring bank. When a customer purchases a product online using a real-time processing Web site, the transaction is approved online without the merchant needing to log in. http://www.infyecommercesolution.com/

    ReplyDelete
  4. Hi! This post is likable and your blog is very interesting, congratulations!
    add your

    ReplyDelete