A customer object can have many cards in Stripe.com. How do you charge an existing card?
I've tried a few things, but the stripe api for some reason borks when to get an old customer token and a new card token instead of just creating a new card on that customer. So I've gone the route of retrieving all the customer's cards, then selecting one by radio button, then submitting the token of the chosen card into a charge
charge = Stripe::Charge.create( :amount => "#{@subscription.price}", :currency => "usd", :card => params[:existing_card_id], :description => "Subscription for #{current_user.email}" )
but I get the error
Stripe::InvalidRequestError: Invalid token id: card_24j3i2390s9df
You can pass your Stripe fees on to your customers by including the fee into the final charge amount. It is important to ensure that this action complies with any applicable laws that pertain to your business.
How to charge a guest in Stripe Follow. Login to Stripe > Click on Customers > Locate the customer and click on it. Scroll down to make sure a card has been added and locate the Create Payment button. Enter the correct amount, description and charge the card.
To include a one-time charge or discount to the first subscription invoice, you can do so by adding an invoice item to the customer before creating the subscription. This can be done using the API or directly in the Stripe Dashboard.
I figured this out.
With existing card tokens you have to send in the customer token as well
charge = Stripe::Charge.create( :amount => "#{@subscription.price}", :currency => "usd", :customer => current_user.stripe_customer_id, :card => params[:existing_card_id], :description => "Subscription for #{current_user.email}" )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With