Skip to main content

Passing name objects to Stripe

Rails • Asked by Charles Smith

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.


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


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.