I can't get my head around this one.
My form passes a params of 106
which is £1.06
.
Charging the card:
amount = params[:amount].to_f
begin
charge = Stripe::Charge.create(
:amount => amount / 100,
:currency => "gbp",
:source => token,
:description => "Example charge"
)
rescue Stripe::CardError => e
# The card has been declined
end
How to prevent:
Invalid integer: 1.06
Where does the integer comes from? I have converted that to float
.