ActiveMerchant Payrix is an add-on for ActiveMerchant which provides a gateway for Payrix's HPP service.
Before installing the gem you should have a Payrix account ready to use. If not then Contact Payrix for more info.
To install simply add the following line to your Gemfile
and then run
bundle install
:
gem 'activemerchant-payrix'
The gateway can be initialised by passing your login details like so:
gateway = ActiveMerchant::Billing::PayrixGateway.new(:login => 'login', :password => 'pass', :business_id => 'num', :service => 'hpp')
Once you have an initialised gateway, you can use the setup_purchase
method:
amount = 1000 # 1000 cents is $10.00 AUD
options = { return_url: return_url } # Pass the return url to Payrix
response = gateway.purchase(amount, options)
if response.sucess?
puts "All OK!"
else
puts response.message # Output the error message
end
activemerchant-payrix is distributed under a standard MIT license, see LICENSE for further information.
Fork on GitHub and after you’ve committed tested patches, send a pull request.
To get tests running simply run bundle install
and then rake test:units
.