lib/pay/stripe/billable.rb
# Used by webhooks when the customer or source changes
Used by webhooks when the customer or source changes
Used by webhooks when the customer or source changes
def sync_card_from_stripe
        stripe_cust = stripe_customer
        default_source_id = stripe_cust.default_source
        if default_source_id.present?
          card = stripe_customer.sources.data.find{ |s| s.id == default_source_id }
          update(
            card_type:      card.brand,
            card_last4:     card.last4,
            card_exp_month: card.exp_month,
            card_exp_year:  card.exp_year
          )
        else
          update(card_type: nil, card_last4: nil)
        end
      end
def sync_card_from_stripe stripe_cust = stripe_customer default_source_id = stripe_cust . default_source if default_source_id . present? card = stripe_customer . sources . data . find { | s | s . id == default_source_id } update ( card_type : card . brand , card_last4 : card . last4 , card_exp_month : card . exp_month , card_exp_year : card . exp_year ) else update ( card_type : nil , card_last4 : nil ) end end
Used by webhooks when the customer or source changes
Used by webhooks when the customer or source changes
# Customer has no default payment source