我正在关注建立条带支付的在线教程。在测试模式中输入卡详细信息后,教师页面会从 create.html.erb 文件中显示“付款成功”消息。
然而,我遇到一个错误,说错误说明#strong> Stripe :: APIConnectionError in ChargesController #create 请查看下面的截图,它说它与Openssl版本有关,虽然我是最新的安装版本。
运行命令后,它让我问,我在cmd中显示了这个: 验证返回码:20(无法获得本地颁发者证书)
charges_controller.rb
class ChargesController < ApplicationController
def create
# Amount in cents
@amount = 500
customer = Stripe::Customer.create(
:email => params[:stripeEmail],
:source => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => @amount,
:description => 'Rails Stripe customer',
:currency => 'usd'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
end
我最近开始学习Rails,对此有任何帮助将不胜感激。谢谢!