Skip to content

ActiveMerchant extension to enable iDeal payments via the Dutch PSP Mollie

License

Notifications You must be signed in to change notification settings

jhaagmans/active_merchant_mollie

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 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/bluetools/active_merchant_mollie.git

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

@gateway = ActiveMerchant::Billing::MollieIdealGateway.new(:partner_id  => your_partner_id)
@response = @gateway.setup_purchase(1000, {
  :return_url       => "http://yourwebsite.com/ideal/return",
  :report_url       => "http://yourwebsite.com/ideal/report",
  :bank_id          => bank_id,
  :description      => "Description of this transaction"
})

# Store the transaction id in your database with a reference to the original order
@transaction_id = @response.token

# Now redirect the user to the selected bank
redirect_to @gateway.redirect_url_for( @response.token )

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 usually sits in the transaction_id GET parameter
@token = params[:transaction_id]

@gateway = ActiveMerchant::Billing::MollieIdealGateway.new(:partner_id  => your_partner_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 [email protected]

About

ActiveMerchant extension to enable iDeal payments via the Dutch PSP Mollie

Resources

License

Stars

Watchers

Forks

Packages

No packages published