TinAlipay¶ ↑
This project rocks and uses MIT-LICENSE.
#this gem for alipay “create_direct_pay_by_user”
1: add gem to your gemfile.
gem ‘tin-alipay’, ‘2.4.3’
bundle
2: Config your alipay.
TinAlipay.pid = 'alipay_pid' #alipay_pid TinAlipay.key = 'alipay_key' #alipay_key TinAlipay.seller_email = '107191613@qq.com' #alipay_email
3: To pay money you should get alipay url.
If you use PC url:
options = { :out_trade_no => '1', :subject => 'your subject', :price => '0.01', :quantity => 1, :return_url => 'http://www.xxxxx.com/call_back' , :notify_url => 'http://www.xxxxx.com/notify_call_back' }
#you can directly redirect_to this url
TinAlipay::Payment.create_direct_pay_pc_url(options)
If you use MOBILE url:
options={ :req_data => { :out_trade_no => '1', :subject => 'your subject', :total_fee => '0.01', :notify_url => "http://www.xxxxx.com/notify_call_back", :call_back_url => 'http://www.xxxxx.com/call_back' }}
#you can directly redirect_to this url
TinAlipay::Payment.create_direct_pay_mobile_url(options)
4: To verify return params of the pc&mobile.
PC:
TinAlipay::Notify.verify?(return_params)
MOBILE:
TinAlipay::Notify::Mobile.verify?(return_params)
#if you have some troble when use this gem,to email me.…..