Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:15:36+00:00 2026-06-09T18:15:36+00:00

I am trying to get IPN from PayPal to work, but it keeps returning

  • 0

I am trying to get IPN from PayPal to work, but it keeps returning INVALID instead of VERIFIED and I can’t see what I’ve done wrong.

At the moment, I have 2 php files using the sample code from paypal’s developer site. The code seem to run fine, I am using the sandbox so I can see the payment being transfered, so I don’t understand why I am getting INVALID.

Can someone have a look at the code as I can’t see what I’ve done wrong.

1. basic_payment.php (the file which sends the payment data to paypal)

<?php
  require_once ("paypalplatform.php");

  $actionType = "PAY";
  $cancelUrl = "http://[my server details go here]/cancel.php";
  $returnUrl = "http://[my server details go here]/success.php";  
  $currencyCode = "GBP";
  $receiverEmailArray = array( 'seller_15456764326_biz@mail.com' );
  $receiverAmountArray = array( '2' );
  $receiverPrimaryArray = array();
  $senderEmail = "";      
  $feesPayer = "";
  $ipnNotificationUrl = "http://[my server details go here]/ipn.php";
  $memo = "";     
  $pin = "";      
  $preapprovalKey = "";       
  $reverseAllParallelPaymentsOnError = "";        
  $trackingId = generateTrackingID(); 
  $receiverInvoiceIdArray = array( $trackingId );
  $resArray = CallPay ($actionType, $cancelUrl, $returnUrl, $currencyCode, $receiverEmailArray,
                          $receiverAmountArray, $receiverPrimaryArray, $receiverInvoiceIdArray,
                          $feesPayer, $ipnNotificationUrl, $memo, $pin, $preapprovalKey,
                          $reverseAllParallelPaymentsOnError, $senderEmail, $trackingId
  );
  $ack = strtoupper($resArray["responseEnvelope.ack"]);
  if($ack=="SUCCESS")
  {
      if ("" == $preapprovalKey)
      {
          $cmd = "cmd=_ap-payment&paykey=" . urldecode($resArray["payKey"]);
          RedirectToPayPal ( $cmd );
      }
      else
      {
          $payKey = urldecode($resArray["payKey"]);
          $paymentExecStatus = urldecode($resArray["paymentExecStatus"]);
      }
  } 
?>

2. ipn.php (the file which listens for paypals response)

<?php

    $ipn_post_data = $_POST;

    $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

    $request = curl_init();
    curl_setopt_array($request, array
    (
        CURLOPT_URL => $url,
        CURLOPT_POST => TRUE,
        CURLOPT_POSTFIELDS => http_build_query(array('cmd' => '_notify-validate') + $ipn_post_data),
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_HEADER => FALSE,
    ));

    $response = curl_exec($request);
    $status   = curl_getinfo($request, CURLINFO_HTTP_CODE);

    curl_close($request);

    $to = "oshirowanen@mail.com";
    $from = "me@desktop.com";
    $subject = "response";
    $message = "<pre>".print_r($status,true)." - ".print_r($response,true)."</pre>\n";

    $header = 'To: Oshirowanen <oshirowanen@mail.com>' . "\r\n";
    $header .= 'From: Me <me@desktop.com>' . "\r\n";

    mail($to,$subject,$message,$header);

?>

The error messages:

Apache error log – No errors

Which is why I added the email stuff in ipn.php to try to capture something, and it is returning:

<pre>200 - INVALID</pre>

Can anyone see what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:15:38+00:00Added an answer on June 9, 2026 at 6:15 pm
    1. Got it working using the basic sample code 4b,

    2. Cleared $ipnNotificationUrl = ""; from the basic sample code as I had a value in there which I added myself,

    3. Created a seller account instead of a business pro account in sandbox,

    4. Set the seller account to enable the ipn url,

    5. Used the following PHP 5.2 sample code for the ipn listener

    6. Added the 2 lines into the listener, as described here, the 2 lines can be seen below:

    7. Downloaded the cacert.pem certificate to my server from here and put it in the same directory as the ipn listener:

    The 2 lines mentioned in point 6:

    CURLOPT_SSL_VERIFYPEER => TRUE,
    CURLOPT_CAINFO => 'cacert.pem',
    

    I have no idea why the sandbox business pro account does not let me set an ipn url, but the seller account does.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have the PAYPAL IPN work with 2 different sites, I can't
Trying to get this expression to work, can someone look at it and tell
Trying to get these list headings to line up correctly, but I can't figure
Hi I'm trying to get the referrer url but it doesn't work when the
I am trying to implement django-paypal (dcramer's version) with IPN and although I get
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I am trying get date of call but it's returning value of 1.1.1970(I think
I am trying to get Paypal's IPN service working within my app. When I
I'm having the most difficult time trying to get the PayPal IPN subscription Id.
I am trying get the data from my database but i am not getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.