我使用的是paypal重复使用的gem:
https://github.com/fnando/paypal-recurring
对于ruby on rails应用程序
下面是我的代码中的一部分:
def make_recurring
process :request_payment
if @plan
create_units
process :create_recurring_profile, period: @plan.recurring, amount: (@plan.price), frequency: 1, start_at: Time.zone.now
end
end
def process(action, options={})
not_recurring_amount = @cart.total_price
not_recurring_amount += 19.95 if @plan #add activation price for first payment
options = options.reverse_merge(
token: @order.paypal_payment_token,
payer_id: @order.paypal_customer_token,
description: "Your product total is below",
amount: not_recurring_amount.round(2),
currency: "USD"
)
response = PayPal::Recurring.new(options).send(action)
raise response.errors.inspect if response.errors.present?
response
end从本质上讲,用户购买产品后收取239.95的费用。然后,用户购买具有一次性激活的产品计划,并收取33.95的费用。这些都是一次性付款。然后,当他们购买该套餐时,他们还需要为该通话时间套餐收取14.95的重复月费。一切似乎都正常,但我注意到在我的paypal沙箱账户中,另一个重复收费是空白的:

为什么会发生这种空白电荷?
发布于 2013-05-10 21:11:39
这不是一个实际的费用,它只是一个正在创建的个人资料的记录。您必须先创建配置文件,然后才能对其进行收费。正如您所看到的,这反映在PayPal帐户中。
https://stackoverflow.com/questions/16473088
复制相似问题