Reputation: 1203
I'm not sure what I'm missing, I'm trying to use Stripe Payments with a shopping cart checkout sytem. I keep getting the following error:
/Users/dave/rails_projects/testapp/app/controllers/calendars_controller.rb:78: syntax error, unexpected keyword_end, expecting $end
The action from the form
def create
@cart = current_cart
@calendar = Calendar.new(params[:calendar])
@calendar.add_line_items_from_cart(current_cart)
if @calendar.save
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
redirect_to calendar_path, notice: 'Your order is done.'
end
# Amount in cents
@amount = @cart.total_price
customer = Stripe::Customer.create(
:email => '[email protected]',
:card => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => @amount,
:description => 'EquiptMe Gear Rental',
:currency => 'usd'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to charges_path
end
end
The View
<script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
data-key="<%= Rails.configuration.stripe[:publishable_key] %>"
data-description="A month's subscription"
data-amount="500">
</script>
Upvotes: 0
Views: 269
Reputation: 696
You have one too many end. Remove the last 'end' and it should work
Upvotes: 1