Skip to main content

benecaster_subscription_payment_method_updated

Action Premium

Fires when a built-in membership subscriber successfully updates their payment method through the native billing portal. At this point the new PaymentMethod has been attached to the Stripe customer and set as both the customer default and the subscription default.

Unlike webhook-driven events, this action always fires with $user_id set to the logged-in subscriber who made the change — the actor is always known. It fires only on subscriber-initiated portal writes; programmatic payment method changes via the Stripe Dashboard or API do not trigger this action. Only built-in membership subscribers trigger this action.

Parameters

Name Type Default Description
$user_id int WordPress user ID
$show_id int ID of the show
$payment_method_id string Stripe PaymentMethod ID now the default

Examples

Write audit log entry

add_action( 'benecaster_subscription_payment_method_updated', function (
    int    $user_id,
    int    $show_id,
    string $payment_method_id
): void {
    $email = get_userdata( $user_id )->user_email;
    my_audit_log_write( "Payment method updated for {$email} (PM: {$payment_method_id})" );
}, 10, 3 );

Send confirmation email via custom integration

add_action( 'benecaster_subscription_payment_method_updated', function (
    int    $user_id,
    int    $show_id,
    string $payment_method_id
): void {
    $user = get_userdata( $user_id );
    wp_mail(
        $user->user_email,
        'Your payment method was updated',
        "Hi {$user->display_name},\n\nYour podcast subscription payment method has been updated."
    );
}, 10, 3 );

Notes

Fires only for built-in membership subscribers. External bridge subscribers never see this action.

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