[英]Testing paypal with rails URL error
我的Rails应用程序中有paypal,我想对其进行测试,该请求看起来不错,但是由于某种原因,提交URL时已附加了localhost:3000并给了我这个错误。 我在secrets.yml文件中称呼地址
[2015-01-20 14:33:31]错误URI :: InvalidURIError:方案http不接受注册表部分:localhost:3000api.sandbox.paypal.com(或错误的主机名?)C:/ Ruby193 / lib / ruby /1.9.1/uri/generic.rb:1202:
rescue in merge' C:/Ruby193/lib/ruby/1.9.1/uri/generic.rb:1199:in
合并中C:/ Ruby193 / lib / ruby /1.9.1/webrick/httpresponse.rb:220setup_header' C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:150:in
setup_header'Csetup_header' C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:150:in
send_response'C:/Ruby193/lib/ruby/1.9 .1 / webrick / httpserver.rb:110:在run' C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in
在start_thread块中'
代码看起来像这样
def paypal_url(return_path)
values = {
business: "username-facilitator@yahoo.com",
cmd: "_xclick",
upload: 1,
return: "#{Rails.application.secrets.app_host}#{return_path}",
invoice: id,
amount: course.price,
item_name: course.name,
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
end
生成的Paypal URL错误:
localhost:3000api.sandbox.paypal.com
将Rails.application.secrets.paypal_host
修改为https://api.sandbox.paypal.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.