micropayment-rails

Use the micropayment API in your Rails project.

Installation

In your Gemfile:

gem 'micropayment-rails'

Usage

In an initializer (e.g. config/initializers/micropayment.rb):

Micropayment.setup do |config|
  config.api_key = 'your api key from micropayment.de'
  config.sandbox = 1  # to enable sandbox mode
end

Let’s play with the API:

# create a blank customer
customer = Micropayment::Customer.create!

# create a customer with a customer id
customer = Micropayment::Customer.create! :customerId => 'my_customer_id'

# create a customer with a bank_account
customer = Micropayment::Customer.create! :bank_account => { :bankCode => '10010010', :accountNumber => '1234567', :accountHolder => 'Jeff Winger' }

# access a customers bank account
customer.bank_account

# set/update a customers bank account
customer.bank_account = { :bankCode => '10010010', :accountNumber => '1234567', :accountHolder => 'Jeff Winger' }

# initiate a session
# (defaults for all hash params can be set on micropayment.de)
Micropayment::Session.create! 'project_key', customer, :amount => 1000, :currency => 'EUR'

Contributing to micropayment-rails

Copyright © 2012 General Scripting UG (haftungsbeschränkt). See LICENSE.txt for further details.