lib/pay/stripe/billable.rb
def update_stripe_card(payment_method_id)
        customer = stripe_customer

        return true if payment_method_id == customer.invoice_settings.default_payment_method

        payment_method = ::Stripe::PaymentMethod.attach(payment_method_id, customer: customer.id)
        ::Stripe::Customer.update(customer.id, invoice_settings: {default_payment_method: payment_method.id})

        update_stripe_card_on_file(payment_method.card)
        true
      rescue ::Stripe::StripeError => e
        raise Error, e.message
      end
# Handles Billable#update_card
#
# Returns true if successful
Handles Billable#update_card
Returns true if successful
Handles Billable#update_card Returns true if successful
def update_stripe_card(payment_method_id)
        customer = stripe_customer
        return true if payment_method_id == customer.invoice_settings.default_payment_method
        payment_method = ::Stripe::PaymentMethod.attach(payment_method_id, customer: customer.id)
        ::Stripe::Customer.update(customer.id, invoice_settings: {default_payment_method: payment_method.id})
        update_stripe_card_on_file(payment_method.card)
        true
      rescue ::Stripe::StripeError => e
        raise Error, e.message
      end
def update_stripe_card ( payment_method_id ) customer = stripe_customer return true if payment_method_id == customer . invoice_settings . default_payment_method payment_method = :: Stripe :: PaymentMethod . attach ( payment_method_id , customer : customer . id ) :: Stripe :: Customer . update ( customer . id , invoice_settings : { default_payment_method : payment_method . id } ) update_stripe_card_on_file ( payment_method . card ) true rescue :: Stripe :: StripeError => e raise Error , e . message end
Handles Billable#update_card
Returns true if successful
Handles Billable#update_card Returns true if successful
payment_method_id