Skip to main content

SubscriptionEndReason

\Benecaster\Bridge\SubscriptionEndReason

Class Premium

The two values a bridge can pass as the optional third $reason argument of the callback registered through BridgeInterface::on_subscription_cancelled(), saying why a membership ended. They are plain string constants rather than an enum so that a third-party bridge can meet the contract without importing anything. A bridge that passes no reason means CANCELLED, and so does a value the class does not recognise.

EXPIRED is a lapse: the membership ran out and was not renewed, such as a fixed-term plan reaching its end or renewals that failed until the membership plugin gave up. CANCELLED is a decision: the member or an admin ended it. The distinction matters to a win-back campaign, which is why benecaster_subscription_expired exists alongside benecaster_subscription_cancelled.

A bridge that never reports expiry leaves a lapsed member’s token active, still counted as paying and never sent the cancellation email. Reporting an expiry for someone who is still subscribed is harmless, because the listener ignores it when a tier remains.

Methods

Method Visibility Since Description
static normalize( mixed $reason ): string Public — Returns EXPIRED when $reason is exactly the string 'expired', and CANCELLED for everything else, including null, an empty string and unrecognised values.

Constants

Name Value Description
CANCELLED 'cancelled' A decision: the member or an admin ended the membership. This is also the meaning of a missing or unrecognised reason.
EXPIRED 'expired' A lapse: the membership ran out and was not renewed.

Notes

A final class with a private constructor, so it cannot be instantiated; use the constants and normalize() statically. The class fires no hooks itself; the cancelled and expired actions are fired by the listener that receives the bridge's callback.