Save 36% for Black Friday! Learn more

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Passing name objects to Stripe

Charles Smith asked in Rails

Hi Chris

A few months ago I purchased the Stripe master class https://courses.gorails.com/payments-with-stripe-and-rails-master-class - awsome - learned a lot!! I could ask this question on Stack Overflow, but since the methods are specific to the course, I thought it be best asked here.

In the user.rb file, there is the method listed below that creates a Stripe customer is one doesn't exist.

def stripe_customer
    if stripe_id?
      Stripe::Customer.retrieve(stripe_id)
    else
      stripe_customer = Stripe::Customer.create(email: email)
      update(stripe_id: stripe_customer.id)
      stripe_customer
    end
  end

Stripe has a customer name field, how can I pass the user_first and user_last along with the email when creating a new customer? I looked on the Stripe api and it doesn't make reference at all to a name object.

Thank you.

Reply

Hey Charles,

I'm pretty sure you want the description attribute and you can pass the user's name in there. https://stripe.com/docs/api/ruby#create_customer-description

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.