David Kimura PRO
Joined 7/18/2015
Drifting Ruby Owner
Ruby Rogues Panelist
David Kimura PRO said almost 4 years ago on Payment Gateway Basics with Stripe :
Ah, okay, I thought that Stripe created the source, but it looks like they're just verifying that the source would be valid.

source = Stripe::Source.create(token: params[:stripeToken])
customer.default_source = source
customer.save

David Kimura PRO said almost 4 years ago on Payment Gateway Basics with Stripe :
  I am really trying to help guide you without giving all of the answers because there is so much in learning to troubleshoot these issues. In your particular case, the Stripe::Source.create has a required parameter called type. Since it would be impossible (or improbable) for anyone to know what that means except for the Stripe developers, it's important to look at their provided documentation. In this case, the Stripe::Source.create points to this reference in the documentation. https://stripe.com/docs/api/sources/create#create_source-type

Since they don't give much meaning to what the type parameter is as far as the available values, we need to look at the source object. https://stripe.com/docs/api/sources/object#source_object-type

Since you're taking in credit cards, you would use the type "card"

So your code should look like

source = Stripe::Source.create(type: 'card', token: params[:stripeToken])

I am not positive, but I would avoid the card_present option as that is typically when the card is physically present when entering the details. 

David Kimura PRO said almost 4 years ago on Booking System :
Thanks for the clarification.

David Kimura PRO said almost 4 years ago on Payment Gateway Basics with Stripe :
Their API within their Docs should be the latest ways of handling changes. Was this all from the same request? It's really strange that the source in the first image doesn't match the source ID from the byebug.

David Kimura PRO said almost 4 years ago on Payment Gateway Basics with Stripe :
With byebuy enabled, and once it gets triggered, head over to stripe to see if you can look up the source that was created before it is assigned to the customer.