我正在使用 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 沙盒帐户中注意到另一个空白的经常性费用:

为什么会出现这种空白收费?
最佳答案
这不是实际收费,它只是正在创建的配置文件的记录。您必须先创建一个配置文件,然后才能对其进行收费。如您所见,这反射(reflect)在 PayPal 帐户中。
关于 Paypal 交易历史创建额外的定期付款,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16473088/