You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is likely a separate feature from Grants—and maybe best suited for a different plugin, entirely.
The notion of "Benefits" here is something that is made available either for the duration of a subscription (perhaps a Grant, in the case of the existing plugin), or an artifact created as part of the renewal process.
Could make #1 a pluggable (or even CP-managed) thing—especially with Craft 4's new Condition Builder coming down the pipeline!
Examples
Grant
A new class Grant implements BenefitInterface or class Grant extends Benefit (TBD) might be registered and have its own handlers for Subscription events (Create, Renew, Expire, etc.)
// Unsure about `implements`, here, or what kind of interfaces we'd have to provide!classGrantextendsBenefitimplementsTemporalGate
{
publicfunctionevents()
{
return [
// Grant a group...self::EVENT_ON_SUBSCRIPTION_START => [$this, 'onSubscriptionStart'],
// ...or revoke it:self::EVENT_ON_SUBSCRIPTION_END => [$this, 'onSubscriptionEnd'],
];
}
// ...
}
Coupon
Monthly one-time-use Commerce coupon (i.e. for a snack service), emitted from the renewal lifecycle.
classGrantextendsBenefitimplementsRecurringArtifact
{
publicfunctionevents()
{
return [
// Create a coupon record with a unique code (or no code, and let it be automatically consumed with their Order):self::EVENT_ON_SUBSCRIPTION_RENEW => [$this, 'onSubscriptionRenew'],
];
}
// ...
}
Daily Digest
A frequent CRON task/clock could trigger things at a given "while subscribed" tick/interval? Say, "every n days at `time," send an email, sync the User's content with an external service, etc.
classGrantextendsBenefitimplementsScheduledService
{
publicfunctionevents()
{
return [
// “Ticks” every [[DateInterval expression]]? Not a Stripe concept. Emit a job, or otherwise collect content at that moment to deliver:self::EVENT_ON_SUBSCRIPTION_TICK => [$this, 'onSubscriptionTick'],
];
}
// ...
}
The text was updated successfully, but these errors were encountered:
This is likely a separate feature from Grants—and maybe best suited for a different plugin, entirely.
The notion of "Benefits" here is something that is made available either for the duration of a subscription (perhaps a Grant, in the case of the existing plugin), or an artifact created as part of the renewal process.
Could make #1 a pluggable (or even CP-managed) thing—especially with Craft 4's new Condition Builder coming down the pipeline!
Examples
Grant
A new
class Grant implements BenefitInterface
orclass Grant extends Benefit
(TBD) might be registered and have its own handlers for Subscription events (Create, Renew, Expire, etc.)Coupon
Monthly one-time-use Commerce coupon (i.e. for a snack service), emitted from the renewal lifecycle.
Daily Digest
A frequent CRON task/clock could trigger things at a given "while subscribed" tick/interval? Say, "every
n
days at `time," send an email, sync the User's content with an external service, etc.The text was updated successfully, but these errors were encountered: