Active Merchant is an extraction from the e-commerce software solution Shopify. Shopify's requirements for a simple and unified API to access dozens of different payment gateways with very different internal APIs was the chief principle in designing the library.

Active Merchant has been in production use since June 2006 and is now used in most modern Ruby applications which deal with financial transactions. It is maintained by the Shopify and Spreedly teams, with much help from an ever-growing set of contributors.

It was developed to for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works excellently as a stand alone library.

What does it look like?

# Send requests to the gateway's test servers
ActiveMerchant::Billing::Base.mode = :test

# Create a new credit card object
credit_card =
  :number     => '4111111111111111',
  :month      => '8',
  :year       => '2009',
  :first_name => 'Tobias',
  :last_name  => 'Luetke',
  :verification_value  => '123'

if credit_card.valid?
  # Create a gateway object to the TrustCommerce service
  gateway =
    :login    => 'TestMerchant',
    :password => 'password'

  # Authorize for $10 dollars (1000 cents)
  response = gateway.authorize(1000, credit_card)

  if response.success?
    # Capture the money
    gateway.capture(1000, response.authorization)
    raise StandardError, response.message

How do I get it?



gem install activemerchant

If you want to install this gem on a High Security setup you need to
gem cert --add gem-public_cert.pem

Ruby on Rails

Ruby on Rails

Add gem 'activemerchant' to your Gemfile.


Download Release

from RubyGems


Git Clone

from GitHub

ActiveMerchant is a sponsored and made possible by constant development from Shopify and Spreedly.