[MEMBERSHIP] get user ID

I want to know if some do_action available for PayPal single payment gateway after user pays the payment so that I can get user ID?

At membership\app\gateway\paypalsingle\class-ms-gateway-paypalsingle.php I found some do_action hooks, but none of them worked for me.

ms_gateway_paypalsingle_handle_return_before
ms_gateway_paypalsingle_handle_return_after
ms_gateway_paypalsingle_payment_processed_' . $status
  • Panos

    Hey there Eran Heres ,

    It seems that the appropriate value is currently not set to the $status variable once payment is successful. Could you please replace that file:
    \app\gateway\paypalsingle\class-ms-gateway-paypalsingle.php
    with the one attached here?

    Then you should be able to hook to the action like this :

    add_action( 'ms_gateway_paypalsingle_payment_processed_paid', function( $invoice, $subscription ){
    		$member = $subscription->get_member();
    		//You can use $member->id
    	}, 20, 2 );

    I would suggest to first keep a backup of original file by renaming it to class-ms-gateway-paypalsingle.php.txt

    I have talked to developer and this should be added in next update, so you will be able to use the same hook on update.

    Hope this helps!