Error : No route matches [GET] "/cgi-bin/webscr"

Error : No route matches [GET] "/cgi-bin/webscr"

我正在尝试使用基本的 Paypal 为 Rails 众筹项目中的一项任务提供资金。当我点击特定任务的资金按钮时,我创建了一个新的资金表格,用于保存用户选择资金的金额,...等等。然而,在新的资金行动中,当用户点击资金时,我希望 Paypal 处理资金。然而, 我目前收到错误:"No route matches [GET] "/cgi-bin/webscr"

这是我的资金控制者:

class FundingsController < ApplicationController
def new
if params[:todo_item_id]
  @todo_item = TodoItem.find(params[:todo_item_id])
  @funding =  Funding.new
  #(todo_item: @todo_item, user_id: current_user.id)
  raise ActiveRecord::RecordNotFound if @todo_item.nil?
end

end

def create
  @funding = Funding.new(funding_params)
if @funding.save
  redirect_to @funding.paypal_url(funding_path(@funding))
else
  render :new
end
end


protect_from_forgery except: [:hook]
def hook
params.permit! # Permit all Paypal input params
status = params[:payment_status]
if status == "Completed"
  @funding = Funding.find params[:invoice]
  @funding.update_attributes notification_params: params, status: status, transaction_id: params[:txn_id], funded_at: Time.now
 end
 render nothing: true
 end


private

def funding_params
  params.require(:funding).permit(:todo_item_id, :user_id, :amount)
end
end

这是我的资金模型:

 class Funding < ActiveRecord::Base
 has_one :card
 belongs_to :todo_item
 has_one :user

 accepts_nested_attributes_for :card

def payment_method
if card.nil? then "paypal"; else "card"; end
end
serialize :notification_params, Hash
def paypal_url(return_path)
values = {
    business: "mybusinesssandbox@gmail.com",
    cmd: "_xclick",
    upload: 1,
    return: "#{Rails.application.secrets.app_host}#{return_path}",
    invoice: id,
    amount: self.amount,
    item_name: self.todo_item.content,
    item_number: self.todo_item.id,
    quantity: '1',
    notify_url: "#{Rails.application.secrets.app_host}/hook"
}
"#{Rails.application.secrets.paypal_host}/cgi-bin/webscr?" + values.to_query
 end
 end

我不确定为什么此路由对我不起作用。另外,这是我的 app/views/fundings/new.html.erb::

  <h1><strong>Task:</strong> <%=@todo_item.content%><br>
  <strong>Project:</strong> <%= @todo_item.todo_list.title%> </h1>
  <%= form_for @funding, method: :post do |f| %>
  <%= f.hidden_field :todo_item_id, value: @todo_item.id %>
  <%= f.hidden_field :user_id, value: current_user.id %>
  <%= f.label :amount, "Amount you wish to donate in $" %>
  <%= f.number_field :amount %>
  <%= submit_tag "Fund", class: 'btn btn_primary' %>
  <%= link_to "Cancel", todo_list_path(@todo_item.todo_list_id, @todo_i), class: 'btn' %><br>
  <%end%>

我哪里弄错了?

"No route matches [GET] "/cgi-bin/webscr"

您正在向您的服务器而非 Paypal 请求此资源。重新检查:

"#{Rails.application.secrets.paypal_host}/cgi-bin/webscr?" + values.to_query

Rails.application.secrets.paypal_host可能是空白!