我正在尝试在我的应用程序中使用 ActiveMerchant 实现贝宝服务。我的开发者的贝宝账户是为 API 证书凭证设置的。以下代码在与 API 签名一起使用时效果很好,但在我尝试实现 API 证书时给我一个错误。有人可以帮忙吗?
PAYPAL_CERT_PEM = File.read("#{Rails.root}/certs/paypal_cert_dev.pem")
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
:login => "****************",
:password => "**************",
:certificate => PAYPAL_CERT_PEM
}
::STANDARD_GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(paypal_options)
end
错误 :
/Library/Ruby/Gems/1.8/gems/activemerchant-1.12.1/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb:72:in `initialize': An API Certificate or API Signature is required to make requests to PayPal (ArgumentError)