WordPress.org

Support

Support » Plugins and Hacks » [Resolved] hook for successful paypal purchase

[Resolved] hook for successful paypal purchase

  • Hello, bear with me for a brief paragraph describing my situation. I promise there’s a question after that.

    I’m using Zapier, a service that let’s you hook some actions in one application and trigger some reaction in others. For example, they have a “subscribe user to mailchimp list on successful paypal transaction” and it works great. They provide you with a url that you can use as your IPN listener… and there’s the problem. I want EDD to process the IPNs for obvious reasons.

    The only solution I found was to add a bit of extra code at the end of the edd_process_paypal_ipn() function (the file is paypal-standard.php. Down there, I still have access to $encoded_data_array and can use it to form a custom $remote_post_vars and send it to zapier’s url. It works. EDD gets to process the IPN and zapier gets to have its own copy in case the transaction was successful.

    Here’s the thing, though. That’s the only place I found to make the change, so after every update I have to go back and re-apply the change. It would be great if I can have my little bit of code separately (as a plugin or in functions.php) that hooks an action on a successful transaction.

    Would this be possible? Or maybe it already is and I’m missing something?

    BTW, this was the solution that first came to mind, but I accept opinions on whether there are better options that don’t require this little modification.

    Thanks.

    http://wordpress.org/extend/plugins/easy-digital-downloads/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pippin Williamson

    @mordauk

    Pippin's Plugins and Plugin Reviewer

    You will want to hook into the edd_update_payment_status hook, like this:

    function demo_edd_completed_purchase( $payment_id, $new_status, $old_status ) {
    	if ( $old_status == 'publish' || $old_status == 'complete' )
    		return; // Make sure that payments are only completed once
    
    	// Make sure the payment completion is only processed when new status is complete
    	if ( $new_status != 'publish' && $new_status != 'complete' )
    		return;
    
    }
    add_action( 'edd_update_payment_status', 'demo_edd_completed_purchase', 100, 3 );

    Thanks, Pippin. Much appreciated.

    Hi ChichipioWilson

    I’m trying to do EXACTLY what you are doing.

    Did you have any luck in the end?

    Zapier seems to pick up transactions that don’t go through EDD, so I suspected it was the notification_url that was hard coded into the EDD button, perhaps.

    Although seeing your post, I might have been wrong.

    I don’t really understand what you did to fix it above, and I’m not quite sure about hacking around in the core EDD files.

    If you have any pointers, I would greatly appreciate it!

    Doug

    Plugin Author Pippin Williamson

    @mordauk

    Pippin's Plugins and Plugin Reviewer

    @db9429 Can you tell me exactly what you’re trying to do? Is it an integration with Zappier?

    Hey Pippin,

    I’ve actually opened a thread on the EDD forum too:

    https://easydigitaldownloads.com/support/topic/paypal-payments-with-ipn/

    I think that outlines what I’m trying to achieve 🙂

    Doug

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] hook for successful paypal purchase’ is closed to new replies.