我正在尝试在我的rails应用程序上使用paypal express checkout并且我一直收到“请输入有效的信用卡号码并输入”。错误。这是我的代码
在模型中:
def process(order)
return true if !self.new_record?
ActiveMerchant::Billing::Base.mode = Piggybak.config.activemerchant_mode
calculator = ::PiggybakPaypal::PaymentCalculator::Paypal.new(self.payment_method)
self.month = Time.now.month
self.year = Time.now.year
order_total = (order.total_due * 100).to_i
res = calculator.gateway.purchase(order_total, express_purchase_options)
if res.success?
return true
else
logger.debug "This is from debug"
order.errors.add :payment_method_id, res.message.to_s
return false
end
end
def express_purchase_options
{
:ip => request.remote_ip,
:token => self.token,
:payer_id => self.payer_id
}
end
现在我真的很困惑。这是我发错的选项吗?如果是这样我该怎么检查呢?或者它是我使用paypal网关错误的方式?我搜索周围有人说paypal沙盒可能会导致问题?