andrewculver / koudoku

Robust subscription support for Rails with Stripe.
MIT License
1.16k stars 187 forks source link

Multi-Model Support for Koudoku #196

Closed RailsCod3rFuture closed 5 years ago

RailsCod3rFuture commented 5 years ago

I have a User model and an Employer model with different stripe subscriptions. What approach should I take to support each model without causing issues?

RailsCod3rFuture commented 5 years ago

In the case below, config.subscriptions_owned_by = :user. How can I include the employer on this line, alongside the user?

# /config/initializers/koudoku.rb
Koudoku.setup do |config|
  config.subscriptions_owned_by = :user
  config.stripe_publishable_key = ENV['STRIPE_PUBLISHABLE_KEY']
  config.stripe_secret_key = ENV['STRIPE_SECRET_KEY']

  # add webhooks
  config.subscribe 'charge.failed', YourChargeFailed
end
andrewculver commented 5 years ago

Koudoku doesn't currently support this use case, so you'd have to implement it yourself. It will certainly be a lot of effort, but if you do get this working, please consider submitting a pull request so others can benefit as well!