Project

sofort

0.02
No release in over 3 years
Low commit activity in last 3 years
Gem for use Sofort Api in Ruby. Payments and check details. SOFORT Überweisung - Sofort Api Banking
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
~> 3.3.0
~> 1.22.2

Runtime

< 6.0, >= 4.2
~> 3.2.2
~> 0.13.7
~> 1.1.5
 Project Readme

Sofort

Gem for use Sofort Api in Ruby. Payments and check details. SOFORT Überweisung - Sofort Api Banking https://www.sofort.com/integrationCenter-eng-DE/content/view/full/2513

Installation

Add this line to your application's Gemfile:

gem 'sofort'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sofort

Usage

generate initializer file(confing/initializers/sofort.rb). You can change a lot of defaults

rails g sofort:install

init api client

client = Sofort::Client.new

Example of pay

you can set more attributes, please look at config/initializers/sofort.rb

client.pay(12, 'skopu', { success_url: 'http://google.com', abort_url: 'https://google.com', notification_url: 'https://google.com' } )
=> {"transaction"=>"89043-182942-5490DD29-53B3",
"payment_url"=>
"https://www.sofort.com/payment/go/894515b4df08d438eb76320asdasde3383ed72ae80"}

Example of details

When no results

client.details('89043-182942-5490DD29-53B3')
=> {"transactions"=>nil}

When results

client.details('89043-182942-5490DD29-53B3')
=> {"project_id"=>"your project id",
"transaction"=>"89043-182942-5490DD29-53B3",
"test"=>"0",
"time"=>"2014-12-16T17:16:21+01:00",
"status"=>"untraceable",
"status_reason"=>"sofort_bank_account_needed",
"status_modified"=>"2014-12-16T17:16:21+01:00",
"payment_method"=>"su",
"language_code"=>"de",
"amount"=>"42.00",
"amount_refunded"=>"0.00",
"currency_code"=>"EUR",
"reasons"=>{"reason"=>"Order 212"},
"user_variables"=>nil,
"sender"=>
{"holder"=>"Payer Name",
 "account_number"=>"12312312",
 "bank_code"=>"12312312",
 "bank_name"=>"Deutsche Bank AG",
 "bic"=>"DEUTDEDBHAN",
 "iban"=>"DE50250700240444432900",
 "country_code"=>"DE"},
"recipient"=>
{"holder"=>"Company on Demand",
 "account_number"=>"12312312",
 "bank_code"=>"12312312",
 "bank_name"=>"Commerzbank AG",
 "bic"=>"C12312312",
 "iban"=>"DE12312312",
 "country_code"=>"DE"},
"email_customer"=>"your@gmail.com",
"phone_customer"=>nil,
"exchange_rate"=>"1.0000",
"costs"=>{"fees"=>"0.63", "currency_code"=>"EUR", "exchange_rate"=>"1.0000"},
"su"=>{"consumer_protection"=>"0"},
"status_history_items"=>
{"status_history_item"=>
  {"status"=>"untraceable",
   "status_reason"=>"sofort_bank_account_needed",
   "time"=>"2014-12-16T17:16:21+01:00"}}}

Pure ruby usage

require 'sofort'
require 'sofort/client'

Sofort.setup do |config|
  config.base_url = 'https://api.sofort.com/api/xml'
  config.user_id = 'id'
  config.api_key = 'key'
  config.abort_url = 'http:/google.pl'
  config.success_url = 'http:/google.pl'
  config.notification_url = 'http:/google.pl'
  config.language_code = 'de'
  config.email_customer = 'sebastian.skopp@gmail.com'
  config.notification_email = 'sebastian.skopp@gmail.com'
  config.country_code = 'DE'
  config.currency_code = 'EUR'
  config.reason = 'Reason'
  config.user_variable = 'user_variable'
  config.project_id = 'project_id'
end

client = Sofort::Client.new

client.pay(12, 'skopu', { success_url: 'http://google.com', abort_url: 'https://google.com', notification_url: 'https://google.com' } )

Contributing

please remember to @mention me ;)

  1. Fork it ( https://github.com/skopu/sofort/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request