Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    PayPal IPN Integration WordPress

    PayPal IPN Integration WordPress – Instant Payment Notification (IPN)  is a message service that automatically notifies merchants of events related to PayPal transactions.

    Merchants can use it to automate back-office and administrative functions, including automatically fulfilling orders and providing customers with order status.

    We are discussing here for subscription based transactions using PayPal recurring payment. IPN becomes important when new transaction occurred to your account and you don’t know about transaction details that who buy the plan, etc.

    So, IPN is the message which contains all the information regarding transaction.

    To Setup IPN , enable IPN from PayPal site in user profile selling tools section. You have to set notification URL at PayPal site. PayPal will send IPN to that particular action in URL.

    Lets’s start coding…

    First set notification URL, like

    In functions.php file, write functions to get IPN message,

    In the above line of code, we describe action for paypal_ipn function with init hook, now define function,


    Now, define function check_ipn used in above function,

    In above function, we check for the ipn response whether it is valid or not using check_ipn_valid function. If it is valid, we send back OK message to PayPal. Let’s come to the check_ipn_valid function,



    In above function, we post back the data recieved with ‘cmd’=_notify_validate appended in the response to validate the response.

    Now, if everything goes fine then we get ipn status true for ipn_request function otherwise false. So. lets’s come to the ipn_request function,


    Now, you can do what you want with data in $posted, like save into database or mail it to concerned person. To know about the data contained in $posted, you can check here.


    Still have any issue feel free to add a ticket and let us know your views to make the code better

    Thanks for Your Time! Have a Good Day!


    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Shiv
    Hi Varun!
    Could you please tell how would I obtain payment_status in the result and use it to allow my website users to see the download button?
    • Varun Kumar
      Hi Shiv,

      To obtain the payment status in the result you can use ‘payment_status’ key from the array variable retrieved in last function code written in blog named ‘ipn_request’. Using $posted[‘payment_status’] one can check the status.


  • Andrew McCombe
    Thanks. This information is hard to find on the internet.
    • Amit Chauhan
      Yes indeed 🙂
  • Ashu Sachdev
    add_action( ‘init’, ‘paypal_ipn’ ); and Function name are different how is call
    • Varun Kumar
      Hi Ashu, thanks for your suggestion. Now we have corrected the issue and it will work fine now. Thanks.
  • Ashu Sachdev
    add_action( ‘init’, ‘paypal_ipn’ ); and Function name are different how is call
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again

    Table of Content

    Hide Index