Spree Commerce

Try It Now

Core Payment Gateway Extension is Finished

Posted on May 23, 2008 by Sean Schofield

I have just checked in a major improvement to the payment_gateway extension (part of the core Spree functionality.) You can now use /admin/gateways to configure your payment gateway (the old method involved editing environment.rb). So far the only gateways supported are the Bogus Gateway and LinkPoint. Not a lot of choices but that is easily fixed. We just need to test each of the ActiveMerchant gateways with Spree and then add them to the extension.

In development mode, you will always use the BogusGateway no matter what gateway you have chosen. In test mode you will get your chosen gateway but it will be set to test mode. ActiveMerchant handles what exactly test mode implies for each gateway, but it usually involves a special test URL for your gateway and possibly passing other parameters to indicate a test. Production mode will use the live gateway in the manner your would expect.

Besides adding a useful feature, this was also a nice test of the extension mechanism. This also makes a good example to look at for those of you contemplating making your own extensions. The only real problem I have noticed is that the routes introduced by an extension do not automatically reload in development mode. So that stuff required restarting the server every time I wanted to change the route. Rails has spoiled me to the point that a single reload of my server annoys me. I’ll track this down and fix it shortly.