You cannot use a Stripe token more than once
<p>I cannot seem to charge a card then create a customer on the fly in Rails 4.</p>

<pre><code>def charge
 token = params[:stripeToken] # can only be used once.
 begin
  charge = Stripe::Charge.create(
    :amount =&gt; 5000,
    :currency =&gt; "gbp",
    :source =&gt; token,
    :description =&gt; "Example charge"
  )
 rescue Stripe::CardError =&gt; e
  # The card has been declined
 end

 if current_user.stripeid == nil
  customer = Stripe::Customer.create(card: token, ...)
  current_user.stripeid = customer.id
  current_user.save
 end
end
</code></pre>

<p><a href="https://stackoverflow.com/questions/30334678/how-to-create-both-a-customer-and-a-card-in-a-single-action-with-stripe">I have looked at this</a> but there is no such thing as <code>token.id</code> as <code>token</code> is just a <code>String</code>.</p>