Swiss Active Merchant

Swiss Active Merchant stands as an expanded iteration of the Active Merchant gem, designed to offer an enriched experience in handling financial transactions within Ruby applications. Serving as an extension to the renowned Active Merchant, Swiss Active Merchant introduces additional payment gateways.

Installation

From RubyGems

Installation from RubyGems:

gem install swiss-activemerchant

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

gem 'swiss-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

Supported Payment Gateways

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

Publishing Changes to RubyGems

If you make changes or improvements to this project, we encourage you to share these updates with the community. Follow the steps below to publish your changes to RubyGems:

  1. Increment Version: Update the version number in the lib/your_gem/version.rb file.
module YourGem
  VERSION = 'x.x.x'
end
  1. Build Gem: Build the gem using the following command:
gem build activemerchant.gemspec
  1. Push to RubyGems: Push the updated gem to RubyGems:
gem push swiss-activemerchant-x.x.x.gem
  1. Yank Previous Version: If necessary, yank the previous version to prevent installations:
gem yank swiss-activemerchant -v x.x.x

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.5+ and Rails 5.0+ are supported.