1

我目前正在尝试将条形支付网关添加到我的导轨应用程序,但在收到付款详细信息时出现错误。该错误是“找不到专柜::订购与‘ID’=”将条形支付网关添加到导轨应用程序

应用程序/控制器/ orders_controller.rb:

def payment 
@order = Shoppe::Order.find(session[:current_order_id]) 
    if request.post? 
    if @order.accept_stripe_token(params[:stripe_token]) 
     redirect_to checkout_confirmation_path`enter code here` 
    else 
     flash.now[:notice] = "Could not exchange Stripe token. Please try again." 
    end 
    end 
end 

我正在关注的专柜网站http://tryshoppe.com/docs/payment-gateways/stripe的教程文档。 Rails应用程序说上面代码的第2行是问题,我认为它与'current_order_id'有关。任何帮助,这将不胜感激。

+0

什么是id输出为?它是零吗?也许current_order_id没有保存到会话散列? – JCDJulian

+0

对不起,我是新来的铁轨。我不确定它是否保存到会话散列,我该如何检查?也许我可以告诉你一个不同的文件? – htmlpls

+0

或者使用调试器,输出到记录器(http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger),或者只写“puts session [:current_order_id]”,然后查看服务器中输出的内容控制台正在执行该方法时。 – JCDJulian

回答

0

您可以使用我最近所做的Ruby on Rails的条带支付的简单示例。检查代码在GitHub上的位置:PUBLISHABLE_KEY = pk_test_g0XSu8r2ugAETksVJQXJjU30 SECRET_KEY = sk_test_A3rwGLOMNxEKDkaJOTgi4frd轨小号

在付款方式
0

,我的解决方案的想法:

#comment out first line. 
#@order = Shoppe::Order.find(session[:current_order_id]) 

#Add line from below: 
@order = Shoppe::Order.find(current_order.id) 

作品https://github.com/ab00zar/StripePayment-example

使用类似测试键运行服务器我。