Payonline
This is a thin wrapper library that makes using PayOnline API a bit easier.
Installation
Add this line to your application's Gemfile:
gem 'payonline'
And then execute:
$ bundle
Configuring
Create an initializer: config/initializers/payonline.rb
:
Payonline.config do |config|
config.merchant_id = '12345'
config.private_security_key = 'your-private-security-key'
config.return_url = 'https://example.com/payments/success'
config.fail_url = 'https://example.com/payments/fail'
end
Usage
Get payment URL:
Payonline::PaymentGateway.new(order_id: 1, amount: 2.0, currency: 'RUB').payment_url
Implement a callback action that will be called by PayOnline after a transaction is completed:
@response = Payonline::PaymentResponse.new(params)
if @response.valid_payment?
Order.find(@response.order_id).set_paid!
end
Contributing
- Fork it
- Clone it
git clone https://github.com/SumatoSoft/payonline
- Create your feature branch
git checkout -b my-new-feature
- Commit your changes
git commit -am 'Add some feature'
- Push to the branch
git push origin my-new-feature
- Create new pull request through Github