• Resolved clautrade

    (@clautrade)


    Hello, I’m using the action hook pmpro_subscription_payment_completed but unfortunately I get 2 issues and I hope to fix it…

    1) It seems not work with recurring payments.
    In the recurring payments, Paypal (by IPN) send: txn_type=recurring_payment_profile_created”
    In the file … wp-content/plugins/paid-memberships-pro/services/ipnhandler.php at LINE 61 it’s written:

    
    "PayPal Express
    	- we will get txn_type express_checkout, or recurring_payment_profile_created, or ..."
    
    

    So, it seems to work with recurring payments but I cannot find such rule/action about recurring_payment_profile_created, I think that this is why it doesn’t work. Could you confirm please?
    Is there an hook to run down IPN recurring payment confirmation?

    2) Mail is sent before Hook.
    I’m using the hook to Update user meta. The only MAIL seeded to user after payment is the INVOICE MAIL, I’m adding info about the User Meta updated by the Hook to inform the user after payment. Unfortunately it does not work fine as it send the data BEFORE the hook update.

    In the LINE 798 of the file: wp-content/plugins/paid-memberships-pro/services/ipnhandler.php there is the code:

    
    
    	//email the user their invoice
    		$pmproemail = new PMProEmail();
    		$pmproemail->sendInvoiceEmail( get_userdata( $last_order->user_id ), $morder );
    
    		//hook for successful subscription payments
    		do_action( "pmpro_subscription_payment_completed", $morder );
    
    

    It seems that the Hook is placed AFTER the INVOICE MAIL.
    Could you confirm please ? Can you place the hook before? Is there a way to send to users the userdata updated?

    Many thanks. Best Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @clautrade

    The ‘pmpro_subscription_payment_completed’ action will run whenever the pmpro_ipnSaveOrder function is called – https://github.com/strangerstudios/paid-memberships-pro/blob/dev/services/ipnhandler.php#L818.

    This will rely that the IPN request from PayPal is received and correctly processed by Paid Memberships Pro. Are orders being created for recurring payments inside your site okay?

    If you need to send data before the email is sent, you may use the hook “pmpro_subscription_ipn_event_processed” https://github.com/strangerstudios/paid-memberships-pro/blob/dev/services/ipnhandler.php#L801 and write conditional logic around this based off the $ipn_id to ensure it was processed correctly.

    I have passed this onto our developers to consider moving the hook before the email is sent out. I recommend reaching out to a local WordPress developer to assist you in customizing this process for you and assist you in adding custom notifications you require.

    I hope this helps clear things up.

    Thread Starter clautrade

    (@clautrade)

    Hi Andrew,

    I’ll check for ‘pmpro_subscription_ipn_event_processed’ although the most logical is that ‘pmpro_subscription_payment_completed’ run before the mail sender. Many thanks to pass it to developer … hope to see the change soon.

    Anyway the most important of my post/question is POINT 1 to which you have not replied.
    It is strange because ‘recurring_payment_profile_created’ is confirmed in the head explain text but does not appear in the processed code.

    Could you check it too?
    Many thanks. Best Regards

    Plugin Author Andrew Lima

    (@andrewza)

    We do not create an order on ‘recurring_payment_profile_created’, we only run on certain txn_types to create a recurring order based off of a recurring payment that’s been processed.

    The ‘recurring_payment_profile_created’ indicates a subscription was created successfully but not processed. You may be able to use the pmpro_after_checkout hook instead to run code after a successful checkout/manual renewal – https://www.paidmembershipspro.com/hook/pmpro_after_checkout/

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Action Hook pmpro_subscription_payment_completed’ is closed to new replies.