simpleweb/realex-ruby

Name: realex-ruby

Owner: Simpleweb

Description: A Ruby class for interfacing with www.realexpayments.com

Created: 2014-07-07 17:02:05.0

Updated: 2014-07-07 17:03:13.0

Pushed: 2014-07-07 17:12:00.0

Homepage: http://github.com/paulca/realex

Size: 235

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RealEx library for interfacing with www.realexpayments.com

This is a Ruby library for interfacing with the RealEx API ( http://www.realexpayments.com )

Installation
gem install realex
Basic Usage
require 'realex'

RealEx::Config.shared_secret = 'YOUR SHARED SECRET'
RealEx::Config.merchant_id = 'YOUR MERCHANT ID'

card = RealEx::Card.new(:number => '4***************', :cvv => '509', :expiry_date => '0822', :cardholder_name => 'Paul Campbell', :type => 'VISA')

transaction = RealEx::Authorization.new(
:customer_number => 1234, :variable_reference => 1234,
:card => card, :amount => 500, :order_id => 12345, :currency => 'EUR', :autosettle => true)

transaction.comments << "Here's a comment"

transaction.to_xml

transaction.shipping_address = RealEx::Address.new(:type => 'shipping', :code => 'Postal Code', :country => 'Country')

transaction.billing_address = RealEx::Address.new(:type => 'billing', :code => 'Postal Code', :country => 'Country')

transaction.authorize!
Manual Request Type
transaction.manual = true
transaction.authcode = '12345'

transaction.authorize!
Recurring payments
payer = RealEx::Recurring::Payer.new(:type => 'Business', :reference => 'boom', :title => 'Mr.', :firstname => 'Paul', :lastname => 'Campbell', :company => 'Hyper Tiny')

payer.address = RealEx::Address.new(:street => '64 Dame Street', :city => 'Dublin', :county => 'Dublin', :post_code => 'Dublin 3', :country => 'Ireland', :country_code => 'IE', :phone_numbers => { :home => '1234', :work => '1234', :fax => '1234', :mobile => '1234'}, :email => 'paul@rslw.com')

payer.save!

recurring_card = RealEx::Recurring::Card.new(:payer => payer, :reference => 'paulcampbell')

recurring_card.card = card

recurring_card.save!

transaction = RealEx::Recurring::Authorization.new(:amount => 500, :payer => payer, :order_id => order_id, :reference => 'paulcampbell')

transaction.authorize!
Cancelling a recurring payment card
recurring_card = RealEx::Recurring::Card.new(:payer => payer, :reference => 'paulcampbell')

recurring_card.destroy!

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.