Skip to main content

benecaster_subscription_payment_method_updated

Action Free

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 Phase 2 built-in membership subscribers trigger this action.

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 Phase 2 built-in membership subscribers. External bridge subscribers never see this action.