Project

opay

0.01
No commit activity in last 3 years
No release in over 3 years
Payu (polish payment service) rails engine.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

Build Status

Opay

Opay is a payment solution for Rails apps.

Currently supported engines:

  • payu
  • paypal express payment

Installation

Add this to your Gemfile:

gem 'opay'

and run bundle install.

Next, run:

# add an initializer to config/initializers with all of the configuration options
$ rails g opay:install
# This will add the necessary migrations to your app's db/migrate directory
rake opay:install:migrations
# This will run any pending migrations
rake db:migrate

then add the following to your routes.rb file:

# config/routes.rb
get 'success' => 'controller#success', as: :success_payment
get 'cancel' => 'controller#cancel', as: :cancel_payment

mount Opay::Engine => '/opay'

declare which of your models recive payments

class ModelName < ActiveRecord::Base
  include Opay::Payable

  after_payment do
    # optional after payment callback
  end

  def amount
    100
  def
end

create payment form

= opay_form_for @model_name, provider: :payu do |f|
  = f.payment_info first_name: 'Jan', last_name: 'Kowalski', email: 'kowalski@gmail.com', desc: 'Payment description'
  = f.submit 'pay with payu'

set up online url in payu.pl to: /opay/payu/online

= opay_form_for @model_name, provider: :paypal do |f|
  = f.payment_info desc: 'Test payment', client_ip: '127.0.0.1'
  = f.paypal_submit_tag