我正在使用贝宝经常性宝石:
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 的每月定期费用。一切似乎都正常,但我在我的贝宝沙盒帐户中注意到另一个空白的经常性费用:
为什么会出现这种空白收费?