i use paypal-sdk-rest gem. have next def inside of feed.rb(model):
def self.paypal_url(return_path) values = { business: "team@team.com", cmd: "_xclick", upload: 1, return: "#{rails.application.secrets.app_host}#{return_path}", #invoice: id, amount: 0.01, item_name: "9dt9", #item_number: course.id, quantity: '1', notify_url: "#{rails.application.secrets.app_host}/hook" } #"#{rails.application.secrets.paypal_host}/cgi-bin/webscr?" + values.to_query "https://www.paypal.com/cgi-bin/webscr?" + values.to_query end
inside of view file did put:
<%= link_to "checkout", @feed.paypal_url("http://my_website.com/en") %>
for notify_url did use next function in feed_controller:
def hook params.permit! # permit paypal input params #status = params[:payment_status] status = params[:st] if status == "completed" transaction.create(:status => params[:st], :transaction_id => params[:tx], :purchased_at => time.now) puts "data: #{params[:st]} :: #{params[:tx]}" else puts "nothinghere" end render nothing: true end
so, must add parameters table, doesn't. problem, knows? why doesn't insert table?
who can me it?
update
in mginx log get:
parameters: {"tx"=>"9bk361abcdefg473m", "st"=>"completed", "amt"=>"0.01", "cc"=>"usd", "cm"=>"", "item_number"=>"", "locale"=>"en"}
Comments
Post a Comment