0

何が欠けているのかわかりません。ショッピングカートのチェックアウトシステムでStripePaymentsを使用しようとしています。次のエラーが発生し続けます。

/Users/dave/rails_projects/testapp/app/controllers/calendars_controller.rb:78:構文エラー、予期しないkeyword_end、$endが必要です

フォームからのアクション

 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 => 'example@stripe.com',
      :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

景色

<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>
4

1 に答える 1

1

エンドが 1 つ多すぎます。最後の「終わり」を削除すると、機能するはずです

于 2013-02-08T06:58:59.967 に答える