Can't get PayPal checkout errors when insufficient funds

Viewed 375

Can't get my head around PayPal payment response errors or at least warnings. I am Australian developer (at least I am located in Australia and using AUD as a currency).

Could you please tell me why if the sandbox user has insufficient funds the transaction has a positive (valid) response on the request for payment?

So I have user_A who is buyer and a seller_user. user_A has 0AUD and makes a transaction of 20AUD of recurring payments and the response is successful??? Why?

What is the way to get to know that user doesn't have sufficient funds for the transaction?

 gem: paypal-recurring
 rails: 3.2.14
 location: Australia

====== Controller action for redirecting to checkout url

ppl = PayPal::Recurring.new(
  return_url: paypal_confirm_url(:plan_id => params[:plan_id], :user_id => current_user.id),
  cancel_url: paypal_no_checkout_url,
  description: "Starter",
  amount: 15,
  currency: "AUD"
)
response = ppl.checkout
if response.valid?
  redirect_to response.checkout_url
else
  redirect_to :back
end    

==== Controller action after confirmation

ppr = PayPal::Recurring.new(
  token: params[:token],
  payer_id: params[:PayerID],
  description: plan.name,
  amount: plan.value,
  currency: "AUD",
  period: :monthly,
  start_at: Time.zone.now,
  frequency: 1
)
response = ppr.request_payment
if response.errors.any?
  flash.keep[:error] = "Something went wrong please contact paypal or ask our development team: team.grapple1@gmail.com"
  return false
end

response = ppr.create_recurring_profile

paypal_recurring_profile_token = response.profile_id # response.profile_id = nil????
save!
1 Answers
Related