No release in over 3 years
Low commit activity in last 3 years
Use this gem instead of ActiveMerchant gem if you want to use Square's e-commerce APIs (https://squareup.com/developers) with ActiveMerchant. The official ActiveMerchant gem does not support Square because Square shields raw credit card numbers from developers to make PCI compliance easier. This has all ActiveMerchant functionality, plus support of Square's card nonces in the iframe API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 1
~> 10.0

Runtime

 Project Readme

Active Merchant Square

Installation

Add this line to your application's Gemfile:

gem 'active_merchant_square'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_merchant_square

Usage

This simple example demonstrates how a purchase can be made after getting a card nonce

require 'active_merchant_square'

# Get your login and password by going to: https://connect.squareup.com/apps
credentials = {
  login: 'sandbox-sq0idp-APPLICATION_ID',
  password: 'sandbox-sq0atb-APPLICATION_SECRET',
  # How to get your location ID, see: https://docs.connect.squareup.com/articles/faq-lookup-my-location-id
  location_id: 'LOCATION_ID',
}

amount = 1000  # $10.00

gateway = ActiveMerchant::Billing::SquareGateway.new(credentials)
response = gateway.purchase(amount, card_nonce)

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

For more in-depth documentation and tutorials, see Square Documentation site

Simple Web Example

You can take a look at our example application using gem 'sinatra' and gem 'square_active_merchant' here.