根据railscast 中的视频 http://railscasts.com/episodes/289-paypal-recurring-billing
在做paypal循环支付的时候为了先收到钱需要如下代码。
因为创建订单后 paypal会根据start_at的时间去扣费。默认都在第二天 paypal会统一扣费。所以要加上即时支付功能
这时就会遇到这种情况。即时支付付了1个月,循环订单会在第二天也开始支付。这样就产生了两次扣费。所以明显有问题。
这时候就要设置start_at这个选项。让他即时创建,但是延期扣费。
def make_recurring process :request_payment process :create_recurring_profile, {period: :monthly, frequency: timePeriod, start_at: Time.zone.now + 1.month} end