In the case you don’t want to store Direct Stripe users, it is possible to use the action ‘direct_stripe_before_success_redirection’ to actually delete the user just after it is created by Direct Stripe transaction processor.

This code is to be used in your (child-)theme’s functions.php file or a custom plugin.

Find the gist at https://gist.github.com/New0/8b35ab759a7b72b0ca72af3bee790973

add_action( 'direct_stripe_before_success_redirection', function( $charge_id, $post_id, $button_id, $user_id ) {

    if ( ! is_user_logged_in() ) {
      $delete_user = wp_delete_user($user_id);
    }

}, 10, 4 );

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *