WordPress.org

Ready to get started?Download WordPress

Forums

Easy Digital Downloads
[resolved] hook for successful paypal purchase (6 posts)

  1. ChichipioWilson
    Member
    Posted 1 year ago #

    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/

  2. 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 );
  3. ChichipioWilson
    Member
    Posted 1 year ago #

    Thanks, Pippin. Much appreciated.

  4. db9429
    Member
    Posted 8 months ago #

    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

  5. Pippin Williamson
    Pippin's Plugins and Plugin Reviewer
    Plugin Author

    Posted 8 months ago #

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

  6. db9429
    Member
    Posted 8 months ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic