I'm using the paypal recurring gem:
https://github.com/fnando/paypal-recurring
for a ruby on rails application
Here's a selected portion of my code:
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
Essentially, a user buys a product and gets charged 239.95. Then a user buys a plan for the product with a one time activation and gets charged 33.95. Those are both one time payments. Then when they buy the plan, they also get charged a 14.95 recurring monthly charge for that airtime plan. Everything seems to work but I notice in my paypal sandbox account another recurring charge that is blank:
Why is that blank charge happening?