Skip to content
Active Merchant is a simple payment abstraction library extracted from Shopify. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
Branch: master
Clone or download
nicolas-maalouf-cko and filipebarcos Update Checkout.com integration for 3DS (#3240)
* Fix Checkout.com V2 Sandbox URL

* Fix success response code validation

* Fix success response code validation v2

* Improve success response validation logic

* Add list of currencies without fractions

* Add localized_amount support to add_invoice function

* Remove redefinition of currencies_without_fractions

* Add test for Void Authorize with AVS rule

* Align with main repo

* Migrate to unified payments API

* Add 3rd party MPI 3DS support

* Migrate tests to Unified Payments API

* Add third party MPI tests

* Fix 3DS test syntax error

* Syntax fixes

* Fix metadata array initialisation

* Test fixes

* Update response success validation. Fix test

* Fix billing_descriptor conditional inclusion

* Improve payment source identification

* Refund payment ID fix

* Fix setting response ID for capture actions

* Fix remote tests

* Retrieve payment ID from capture responses

* Fix 3DS payload handling

* Fix 3DS syntax error

* Move capture conditional payment ID to successful responses only

* Fix condition to parse payment ID from href link

* Remove trailing whitespaces

* Empty line removed

* Fix metadata

* Block empty strings from being submitted in billing address

* Fix success_from handling for declined payments

* Fix phone number formatting

* Align checkout_v2 to master

* Add version field in 3rd party MPI 3DS support along with ds_transaction_id for supporting 3ds2 results

* Fix 3ds implementation. Update tests
Latest commit 95f412b Jul 18, 2019

README.md

Active Merchant

Build Status Code Climate

Active Merchant is an extraction from the ecommerce system 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.

It was developed for usage in Ruby on Rails web applications and integrates seamlessly as a Rails plugin, but it also works excellently as a stand alone Ruby 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.

See GettingStarted.md if you want to learn more about using Active Merchant in your applications.

If you'd like to contribute to Active Merchant, please start with our contribution guide.

Installation

From Git

You can check out the latest source from git:

git clone git://github.com/activemerchant/active_merchant.git

From RubyGems

Installation from RubyGems:

gem install activemerchant

Or, if you're using Bundler, just add the following to your Gemfile:

gem 'activemerchant'

Usage

This simple example demonstrates how a purchase can be made using a person's credit card details.

require 'active_merchant'

# Use the TrustCommerce test servers
ActiveMerchant::Billing::Base.mode = :test

gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
            :login => 'TestMerchant',
            :password => 'password')

# ActiveMerchant accepts all amounts as Integer values in cents
amount = 1000  # $10.00

# The card verification value is also known as CVV2, CVC2, or CID
credit_card = ActiveMerchant::Billing::CreditCard.new(
                :first_name         => 'Bob',
                :last_name          => 'Bobsen',
                :number             => '4242424242424242',
                :month              => '8',
                :year               => Time.now.year+1,
                :verification_value => '000')

# Validating the card automatically detects the card type
if credit_card.validate.empty?
  # Capture $10 from the credit card
  response = gateway.purchase(amount, credit_card)

  if response.success?
    puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
  else
    raise StandardError, response.message
  end
end

For more in-depth documentation and tutorials, see GettingStarted.md and the API documentation.

Supported Payment Gateways

The ActiveMerchant Wiki contains a table of features supported by each gateway.

API stability policy

Functionality or APIs that are deprecated will be marked as such. Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.

Ruby and Rails compatibility policies

Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.3+ and Rails 4.2+ are supported.

You can’t perform that action at this time.