Skip to main content

benecaster_buyup_subscriber_migrated

Action Premium

Fires once per subscriber successfully migrated onto a buy-up’s new price. Use this to react per subscriber; use benecaster_buyup_price_migration_complete for a single summary instead of one notification per subscriber.

React to a buy-up price migration

Premium Beginner

When a podcaster changes a buy-up’s price, existing holders are grandfathered at their old price by default. The podcaster can instead choose to migrate them onto the new price at their own next renewal — this recipe reacts to that choice.

benecaster_buyup_subscriber_migrated fires once per subscriber successfully moved onto the new price — use it to react per subscriber, e.g. sync a CRM record or log a billing-change event.

benecaster_buyup_price_migration_complete fires once per sweep, carrying the full outcome — use it for a single summary notification instead of one per subscriber.

<?php
add_action(
    'benecaster_buyup_subscriber_migrated',
    function ( int $user_id, int $show_id, int $buyup_id, float $old_price, float $new_price ): void {
        // Log every price migration to an external system, e.g. a CRM.
        my_crm_log_price_change( $user_id, $buyup_id, $old_price, $new_price );
    },
    10,
    5
);

add_action(
    'benecaster_buyup_price_migration_complete',
    function ( int $buyup_id, int $migrated, array $skipped_billing, array $failures ): void {
        // Send your own operator alert if anything needed a second look —
        // Benecaster's own admin notice already covers this for the
        // podcaster, this is for a separate ops channel (e.g. Slack).
        if ( [] !== $failures ) {
            my_ops_alert( sprintf( '%d buy-up migrations failed for buy-up #%d', count( $failures ), $buyup_id ) );
        }
    },
    10,
    4
);

View on GitHub →

Parameters

Name Type Default Description
$user_id int The migrated subscriber.
$show_id int The show the buy-up belongs to.
$buyup_id int The buy-up whose price changed.
$old_price float The price the subscriber was paying before migration, in major units. `0.0` on a manual retry (`POST /buyups/{id}/migrate`) — treat as "unknown," not a real price.
$new_price float The buy-up's current price, in major units.

Examples

Sync a price change to an external CRM

add_action( 'benecaster_buyup_subscriber_migrated', function ( int $user_id, int $show_id, int $buyup_id, float $old_price, float $new_price ): void {
    my_crm_log_price_change( $user_id, $buyup_id, $old_price, $new_price );
}, 10, 5 );

Notes

EmailTriggers::on_buyup_subscriber_migrated() is the sole core listener, sending the buyup_price_migrated email type (gated on the show's _benecaster_show_email_buyup_price_migrated_enabled toggle, default enabled). The email omits the "previously $X" line when $old_price is 0.0. Recipe: See react-to-a-buyup-price-migration.

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