benecaster_buyup_purchased
Fires after a subscriber successfully purchases a buy-up and the grant is active. The Stripe subscription item is already created, the grant row has been written to the database, and the subscriber’s feed token has been updated.
Buy-ups are à-la-carte episode access upgrades available to subscribers on top of their existing plan. This is a Premium hook that only registers when a valid license is active.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID |
$buyup_id |
int |
— | ID of the buy-up record |
$show_id |
int |
— | ID of the show |
$stripe_subscription_item_id |
string |
— | Stripe subscription item ID for the buy-up line item |
Examples
Log purchase to an external CRM
add_action( 'benecaster_buyup_purchased', function (
int $user_id,
int $show_id,
string $buyup_slug,
int $buyup_id
): void {
my_crm_track_event( get_userdata( $user_id )->user_email, 'addon_purchased', [
'buyup' => $buyup_slug,
'show_id' => $show_id,
] );
}, 10, 4 );