The project is in a healthy, maintained state
ActiveMerchant payment gateway implementation for GMO-PG (GMO Payment Gateway) supporting credit card processing with 3DS2.0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0

Runtime

>= 1.100.0
~> 0.5
>= 7.0
 Project Readme

ActiveMerchant GMO-PG

An ActiveMerchant gateway that wraps the GMO Payment Gateway (GMO-PG) payment API.

Features

  • Register / delete stored credit cards (member management)
  • Authorize, immediate capture, capture, void, refund
  • 3DS2.0 authentication
  • Token-based payments
  • Multiple cards per member

Installation

Add this line to your Gemfile:

gem 'active_merchant_gmo_pg'

Then run:

bundle install

Usage

Initializing the gateway

gateway = ActiveMerchant::Billing::GmoPgGateway.new(
  shop_id: 'your_shop_id',
  shop_pass: 'your_shop_pass',
  site_id: 'your_site_id',
  site_pass: 'your_site_pass',
  test: true  # set to false in production
)

Registering a card

credit_card = ActiveMerchant::Billing::CreditCard.new(
  number: '4111111111111111',
  month: 12,
  year: 2025,
  verification_value: '123',
  first_name: 'Taro',
  last_name: 'Yamada'
)

response = gateway.store(credit_card, member_id: 'user123')

if response.success?
  # response.authorization contains an identifier in "member_id|card_seq" form
  puts "Card registered: #{response.authorization}"
else
  puts "Error: #{response.message}"
end

Authorize

response = gateway.authorize(1000, credit_card, order_id: 'order123')

if response.success?
  puts "Authorized: #{response.authorization}"
else
  puts "Error: #{response.message}"
end

Immediate capture (purchase)

response = gateway.purchase(1000, credit_card, order_id: 'order124')

if response.success?
  puts "Charged: #{response.authorization}"
else
  puts "Error: #{response.message}"
end

Capture

response = gateway.capture(1000, authorization)

if response.success?
  puts "Captured"
else
  puts "Error: #{response.message}"
end

Void

response = gateway.void(authorization)

if response.success?
  puts "Voided"
else
  puts "Error: #{response.message}"
end

Refund

response = gateway.credit(1000, authorization)

if response.success?
  puts "Refunded"
else
  puts "Error: #{response.message}"
end

Deleting a stored card

response = gateway.unstore(authorization)

if response.success?
  puts "Card deleted"
else
  puts "Error: #{response.message}"
end

3DS2.0 authentication

To use 3DS2.0, pass the ret_url option to authorize or purchase:

response = gateway.authorize(1000, credit_card,
  order_id: 'order125',
  ret_url: 'https://example.com/callback'
)

if response.success?
  redirect_url = response.params['RedirectUrl']
  # Redirect the user to redirect_url to complete 3DS authentication
end

Configuration

Switching environments

For production, pass test: false:

gateway = ActiveMerchant::Billing::GmoPgGateway.new(
  shop_id: 'your_shop_id',
  shop_pass: 'your_shop_pass',
  site_id: 'your_site_id',
  site_pass: 'your_site_pass',
  test: false
)

Licence

MIT License.

References