benecaster_subscription_free_switch_scheduled
Fires when a built-in-membership subscriber chooses the show’s free plan from the Free Plan section of their account page. Nothing has been charged and nothing about their access has moved. Their Stripe subscription is set to end at $switch_at, the end of the period they have already paid for, and it is not charged again.
This is a move, not a cancellation. At Stripe’s level the request is cancel_at_period_end, because a free tier has no price to schedule onto, so anything you hang on the Stripe state or on a Stripe webhook of your own will report somebody leaving who is staying. They keep their account, their feed URL and the show’s free episodes, and benecaster_subscription_cancelled never fires for them.
The subscriber is still on their paid tier when this fires. Use $to_tier_slug; looking up their current tier returns the one they are leaving. The move can be withdrawn before it lands, so treat anything you record here as provisional and undo it on benecaster_subscription_free_switch_cancelled. When it lands, benecaster_subscription_tier_changed and then benecaster_subscription_free_switch_landed fire.
Buy-ups they pay for end with the paid subscription. Neither benecaster_subscription_tier_switch_scheduled nor benecaster_subscription_cadence_switch_scheduled fires for this move.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID |
$show_id |
int |
— | ID of the show |
$from_tier_slug |
string |
— | The paid tier they are on now, and will stay on until the move lands |
$to_tier_slug |
string |
— | The free tier they will land on |
$switch_at |
int |
— | UTC epoch the move lands on — the end of their current billing period |
Examples
Note the downgrade without treating it as churn
add_action( 'benecaster_subscription_free_switch_scheduled', function (
int $user_id,
int $show_id,
string $from_tier_slug,
string $to_tier_slug,
int $switch_at
) {
// Not a cancellation: they stay a member on the free plan.
my_crm_add_note( get_userdata( $user_id )->user_email, sprintf(
'Moving from %s to the free plan (%s) on %s',
$from_tier_slug,
$to_tier_slug,
gmdate( 'Y-m-d', $switch_at )
) );
}, 10, 5 );
Need this built rather than just documented? See our services →