I have read most of the stripe payment things. They told that first add a card to the customer in stripe means save the card to the customer then make payment. But my requirement makes the payment using the card and no need to save the card details in the stripe.
Below see the code I have passed customer id and stripe token instead of a card id(card_****)
Stripe::Charge.create(
amount: amount_in_cents,
currency: currency_code,
customer: stripe_customer_id,
source: stripe_token
)
But it throws an error
Getting Error as Customer cus_***** does not have a linked card with ID tok_*****
I have read the link Stripe Payment: Getting Error as Customer cus_***** does not have a linked card with ID tok_***** and It told if you are going use both params customer and source then the source should be card id(card_****). Is there any alternate solution how to use?
If you don't want to use a customer you don't have to, just charge the payment token directly and omit the customer argument :
Stripe::Charge.create(
amount: amount_in_cents,
currency: currency_code,
source: stripe_token
)
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