Skip to main content

benecaster_buyup_purchased

Action Premium

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.

It fires only when money changes hands. A buy-up the subscriber gets for nothing, including one they add back from their account page at a price of 0, fires benecaster_buyup_auto_granted instead.

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    $buyup_id,
    int    $show_id,
    string $stripe_subscription_item_id
): void {
    my_crm_track_event( get_userdata( $user_id )->user_email, 'addon_purchased', [
        'buyup_id' => $buyup_id,
        'show_id'  => $show_id,
    ] );
}, 10, 4 );

Need this built rather than just documented? See our services →