benecaster_subscription_cadence_switch_scheduled
Fires after a built-in-membership subscriber schedules a self-service switch to another billing period of their own tier (monthly to annual, or any cadence the tier sells) and Stripe has accepted the Subscription Schedule. Nothing has been charged yet — the new price is billed at the renewal the switch replaces, $switch_at.
It fires for every scheduled switch, including a move to another tier, because both kinds share one mechanism and a subscriber can have only one pending at a time. For a tier move, benecaster_subscription_tier_switch_scheduled fires first, carrying the tier slugs. Nothing about the subscriber’s tier, token or feed URL moves until the switch lands. See benecaster_subscription_cadence_switched for when the switch actually lands, and benecaster_subscription_cadence_switch_cancelled for a switch withdrawn before it does.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID |
$show_id |
int |
— | ID of the show |
$from_price_id |
int |
— | benecaster_membership_prices.id the subscriber pays now |
$to_price_id |
int |
— | benecaster_membership_prices.id the subscriber is switching to |
$switch_at |
int |
— | UTC epoch of the renewal the switch lands on |
Examples
Tell your CRM a switch is scheduled
add_action( 'benecaster_subscription_cadence_switch_scheduled', function (
int $user_id,
int $show_id,
int $from_price_id,
int $to_price_id,
int $switch_at
) {
$email = get_userdata( $user_id )->user_email;
my_crm_add_note( $email, sprintf(
'Billing period switch scheduled for show %d, landing %s',
$show_id,
gmdate( 'Y-m-d', $switch_at )
) );
}, 10, 5 );
Need this built rather than just documented? See our services →