Skip to content

joris/active_merchant_mollie

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Active Merchant for Mollie iDeal

This gem contains an extension of ActiveMerchant [www.activemerchant.org] with support for the Dutch payment service provider Mollie [www.mollie.nl]. The extension allows you to make iDeal transactions based on the Mollie iDeal API.

Installation

To install as a gem using Bundler, add the following to your Gemfile:

gem "active_merchant_mollie"

Run bundle install to install the gem.

You can also install as a Rails plugin:

./script/plugin install git://github.com/joris/active_merchant_mollie.git

Setup the gateway in the appropriate environment configuration files:

config/environments/development.rb config/environments/test.rb

config.after_initialize do
  ActiveMerchant::Billing::Base.mode = :test
  ::GATEWAY = ActiveMerchant::Billing::MollieIdealGateway.new(:login  => your_partner_id)
end

And for production use: config/environments/production.rb

config.after_initialize do
  ::GATEWAY = ActiveMerchant::Billing::MollieIdealGateway.new(:login  => your_partner_id)
end

Usage

Before you start using this gem, please read the API documentation of Mollie on their website: www.mollie.nl/beheer/betaaldiensten/documentatie/ideal. Make sure you have a Mollie account and know your ‘partner id’.

Create a new purchase

response = GATEWAY.setup_purchase(1000, {
  :return_url       => "http://yourwebsite.com/ideal/return",
  :report_url       => "http://yourwebsite.com/ideal/report",
  :issuer_id        => bank_id,
  :description      => "Description of this transaction"
})

# Store the transaction token in the order:
# @order = Order.find(params[:id])
# @order.payment_token = response.token

# Now redirect the user to the selected bank
redirect_to response.url

Receive details of purchase

After the user returns on your website or Mollie requests you report URL, you should check the state of the purchase. Based in the transaction id you can update the state of your order in your database.

# The token sits in the transaction_id GET parameter
token = params[:transaction_id]

@details_response = GATEWAY.details_for( token )

if @details_response.success?
  # The payment was successfull, update the state in your database
else
  # Something went wrong, inspect the error message
  puts @details_response.message
end

Maintainer

This gem is based on ActiveMerchant and abstracted from the MoneyBird [www.moneybird.nl] project. For more information ask the MoneyBird team via info@moneybird.com

About

ActiveMerchant extension to enable iDeal payments via the Dutch PSP Mollie

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%