我正在使用 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/