Method: Pay::Stripe::Billable#sync_subscriptions

Defined in:
lib/pay/stripe/billable.rb

#sync_subscriptions(**options) ⇒ Object

Syncs a customer’s subscriptions from Stripe to the database. Note that by default canceled subscriptions are NOT returned by Stripe. In order to include them, use ‘sync_subscriptions(status: “all”)`.



192
193
194
195
196
197
198
199
# File 'lib/pay/stripe/billable.rb', line 192

def sync_subscriptions(**options)
  subscriptions = ::Stripe::Subscription.list(options.merge(customer: customer), stripe_options)
  subscriptions.map do |subscription|
    Pay::Stripe::Subscription.sync(subscription.id)
  end
rescue ::Stripe::StripeError => e
  raise Pay::Stripe::Error, e
end