Hook a subscriber’s buy-up purchase/cancellation to grant extra benefits or send an email
A buy-up is an optional extra a subscriber adds to an existing subscription — bonus content, a physical perk, early access. When one is bought, you often want to do something beyond taking the money: grant a benefit, send a confirmation, tell a fulfilment system.
benecaster_buyup_purchased fires once the purchase has gone through and been recorded. The order matters and it is in your favour: the record exists before your callback runs, so you can check what the subscriber is entitled to straight away and get the right answer. No waiting, no polling, no re-checking a moment later.
benecaster_buyup_cancelled fires when a subscriber removes one. This is not the moment to withdraw the benefit. They have paid to the end of the current period and keep the buy-up until it elapses. Revoking on this event takes away something they are still paying for.
Code
<?php
add_action( 'benecaster_buyup_purchased', function ( int $user_id, int $buyup_id, int $show_id, string $item_id ): void {
// Send the subscriber a transcript bundle link via a separate email.
my_addon_send_transcript_welcome( $user_id, $buyup_id );
}, 10, 4 );
Hooks Used
Need this built rather than just documented? See our services →