Skip to content

Latest commit

 

History

History
92 lines (61 loc) · 2.45 KB

README.md

File metadata and controls

92 lines (61 loc) · 2.45 KB

eWAY Rapid Ruby Library

Latest Version on RubyGems Software License Build Status

A Ruby Gem to integrate with eWAY's Rapid Payment API.

# with eWAY at:

For testing, get a free eWAY Partner account: https://www.eway.com.au/developers

Installation

The eWAY Ruby Gem requires Ruby 2.0.0 or better, it also requires the rest-client and json gems.

Add this line to your application's Gemfile:

gem 'eway_rapid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install eway_rapid

Usage

See the eWAY Rapid API Reference for usage details.

A simple Direct payment:

require 'eway_rapid'

api_key = 'Rapid API Key'
password = 'Rapid API Password'
endpoint = 'sandbox'

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
transaction.customer = EwayRapid::Models::Customer.new

card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'Ruby Dev'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '22'
card_details.cvn = '123'
transaction.customer.card_details = card_details

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

if response.transaction_status.status?
 puts "Success! ID: #{response.transaction_status.transaction_id.to_s}"
end

Testing

All tests can be run by first installing all dependencies with bundle install then running bundle exec rake

Change log

Please see CHANGELOG for more information what has changed recently.

License

The MIT License (MIT). Please see License File for more information.