Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用post参数重定向到付款URL_Ruby On Rails_Ruby_Payment_Payu_Payumoney - Fatal编程技术网

Ruby on rails 使用post参数重定向到付款URL

Ruby on rails 使用post参数重定向到付款URL,ruby-on-rails,ruby,payment,payu,payumoney,Ruby On Rails,Ruby,Payment,Payu,Payumoney,我想将PayuMoney支付网关集成到我的rails应用程序中。我想通过post请求重定向到支付网关URL,所以我使用HTTparty将请求重定向并发布到payumoney URL 我的控制器: class ClientFeePaymentsController < ApplicationController include HTTParty def fee_payment uri = URI('https://test.payu.in/_payment.php') re

我想将PayuMoney支付网关集成到我的rails应用程序中。我想通过post请求重定向到支付网关URL,所以我使用HTTparty将请求重定向并发布到payumoney URL

我的控制器:

class ClientFeePaymentsController < ApplicationController
 include HTTParty

 def fee_payment
   uri = URI('https://test.payu.in/_payment.php')
   res = Net::HTTP.post_form(uri, 'key' => 'fddfh', 'salt' => '4364')
   puts res.body    
 end 
end
当我运行这个时,我得到了

Missing template client_fee_payments/fee_payment, application/fee_payment with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :axlsx, :jbuilder]}.

无法使用post请求重定向。您需要发送post请求,然后重定向到页面

您应该在控制器方法的末尾使用
重定向到:some\u页面

现在rails正试图呈现“默认”,这就是为什么会出现这种错误

试一试


如何通过post请求重定向到@但是,无法使用post请求重定向。将_重定向到正在使用html中的“Location:url”标题。在重定向到中,您只能使用GETparams@dthal这是正确的。我已经在我的问题中添加了一些可能对您有所帮助的信息。您找到解决方案了吗??
Missing template client_fee_payments/fee_payment, application/fee_payment with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :axlsx, :jbuilder]}.
require "net/http"
require "uri"

uri = URI.parse("http://example.com/search")

# Shortcut
response = Net::HTTP.post_form(uri, {"q" => "My query", "per_page" => "50"})

# Full control
http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"q" => "My query", "per_page" => "50"})

# Tweak headers, removing this will default to application/x-www-form-urlencoded 
request["Content-Type"] = "application/json"

response = http.request(request)