a rails payment engine that supports both alipay and paypal.
- add to Gemfile
gem "pay_fu"
- install gem
bundle install
- generate config file, route and migration file
rails generate pay_fu:install
-
update config file config/pay_fu.yml
-
run migration
rake db:migrate
- in controller file, after user clicking checkout, redirect him to paypal gateway page.
include PayFu::PaypalHelper
def action
...
redirect_to_paypal_gateway(:item_name => "subject", :amount => 123)
return
end
- similar for alipay
include PayFu::AlipayHelper
def action
...
redirect_to_alipay_gateway(:subject => "donatecn", :body => "donatecn", :amount => @donate.amount, :out_trade_no => "123", :notify_url => pay_fu.alipay_transactions_notify_url)
return
end