lib/pay/stripe/billable.rb
# Handles Billable#customer
#
# Returns Stripe::Customer
Handles Billable#customer
Returns Stripe::Customer
Handles Billable#customer Returns Stripe :: Customer
def create_stripe_customer
        customer = ::Stripe::Customer.create(email: email, description: customer_name)
        update(processor: "stripe", processor_id: customer.id)
        if card_token.present?
          payment_method = ::Stripe::PaymentMethod.attach(card_token, {customer: customer.id})
          customer.invoice_settings.default_payment_method = payment_method.id
          customer.save
          update_stripe_card_on_file ::Stripe::PaymentMethod.retrieve(card_token).card
        end
        customer
      end
def create_stripe_customer customer = :: Stripe :: Customer . create ( email : email , description : customer_name ) update ( processor : "stripe" , processor_id : customer . id ) if card_token . present? payment_method = :: Stripe :: PaymentMethod . attach ( card_token , { customer : customer . id } ) customer . invoice_settings . default_payment_method = payment_method . id customer . save update_stripe_card_on_file :: Stripe :: PaymentMethod . retrieve ( card_token ) . card end customer end
Handles Billable#customer
Returns Stripe::Customer
Handles Billable#customer Returns Stripe :: Customer
# Update the user's card on file if a token was passed in