title: Rails - Stripe::InvalidRequestError (Must provide source or customer.)
body: <p>I'm building an application (based in online resource). You can sign up or login with devise. Then, you can buy a product. Or make your own list and sell your products. </p>
  
  <p>I'm integrating Stripe. When I create the Charge, I get this error in the console: <code>Stripe::InvalidRequestError (Must provide source or customer.)</code>.</p>
  
  <p>Here is the code of the orders_controller.rb for the charge action:</p>
  
  <pre><code>Stripe.api_key = ENV["STRIPE_API_KEY"]
  token = params[:stripeToken]
  
  begin
    charge = Stripe::Charge.create(
      :amount =&gt; (@listing.price * 100).floor,
      :currency =&gt; "usd",
      :card =&gt; token
      )
    flash[:notice] = "Thanks for ordering!"
  rescue Stripe::CardError =&gt; e
    flash[:danger] = e.message
  end
  </code></pre>
  
  <p>Of course I'm taking a look in the Stripe API Documentation here: <a href="https://stripe.com/docs/tutorials/charges" rel="nofollow noreferrer">Charge documentation example</a> and here: <a href="https://stripe.com/docs/api#charges" rel="nofollow noreferrer">Charge full API Reference</a></p>
  
  <p>I'm not sure how to handle the <code>:resource</code> or <code>customer</code>. I saw in other materials in the web that some people create a customer. In other sites it says that the <code>:card</code> is deprecated, so I'm a little confused.</p>
  
  <p>I will leave the github repository of my project, and feel free to take a look. I'm trying to deal with Transfers and Recipients too. <a href="https://github.com/carlos99/etsonia" rel="nofollow noreferrer">Project Repository</a></p>
  
  <p>Thanks.</p>