我使用ActiveMerchant处理定期付款。我希望付款的数量有限,但即使我通过“周期”也是如此。当我在沙箱网站上看到我的交易结果时,我的付款没有结束或有限次数的痕迹?
这是我的网关定义:
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
login: "my_api.ca",
password: "QNBW72G3Q999999",
signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31AmVtuyteuytuetwuytwtwEyY5cTGMA"
}
::MY_PAYMENT_GATEWAY = ActiveMerchant::Billing::PaypalCaGateway.new(paypal_options)
end
以下是处理定期付款的代码:
response = MY_PAYMENT_GATEWAY.recurring(amount,
@publisher.credit_card.active_merchant_credit_card,
{:ip => request.remote_ip,
:email => current_publisher.user.email,
:period => 'Month',
:frequency => 1,
:cycles => @chosen_package.duration.to_i,
:start_date => Time.now.to_date,
:description => "Try to pay only @chosen_package.duration times !? "})
我的理解是“周期”。参数应该反映为沙箱测试站点的最大充电次数,但我被卡住......就像它不起作用一样!?
任何帮助表示赞赏!很多!
Serge
答案 0 :(得分:0)
我通过挖掘ActiveMerchant源找到它...好的参数名称是:total_billing_cycles ,而不是:我所拥有的文档中所述的周期......
现在像魅力一样工作: - )