Allow subscribed and other methods to check for any active subscription and not just one with the name "default" #1619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the code always expects a subscription called "default" when checking any of the subscribed, or on trial methods without passing an argument.
For my specific use case (and I do believe many others), we have a few products all with ids
prod_xxxx
with meaningful names likeMonthly Subscription
, andAnnual Subscription
, and we only want to know if a user is subscribed to any one of these by default (i.e to hide links to subscribe, and show subscription functionality) and don't want to do multiple if checks, checking if they are subscribed to one of our specific plans.We have already solved this on our project, by simply copying the changes in this PR into the User model, to override the Cashier functions, but to me in 2023 it makes no sense to always assume it is titled
default
.This should not break any existing implementations, unless they have multiple subscriptions, with one called
default
. In this case, the code may or may not return the right subscription with no arguments.