Forums

cURL action after Paypal IPN verification

higgle 27 Dec, 2013
Hi, I'm trying to:
(a) process a Paypal payment, then
(b) on IPN verification use the cURL action containing data from two of the fields from the form.

I'm trying to save the field data to a session and then retrieve it to be used in the cURL action after the IPN is verified.

Everything goes to Paypal correctly and the payment is successful.
But the cURL POST is not sent.

I've attached the actions from the form.

Any idea where I'm going wrong? Is there a better way to do it? Thanks a lot.
GreyHead 27 Dec, 2013
Hi higgle,

One fundamental problem here, you can't use the Session data in the IPN action as they are completely independent. The main form is part of the current user session but the IPN transaction is a 'behind the scenes' hand-shake transaction between PayPal and your site.

The way to get the data is either (a) to send it all to PayPal in the first place as they will echo it back in the hand-shake (but to do this you have to fit it into the allowed parameters); or (b) and better IMHO, save it to a DB table before redirecting the user to PayPal, send a unique key to PayPal and use the key to recover the data from the database table in the IPN event.

I don't know Max's IPN Listener very well (I've handcoded my own Custom Code when I've needed to do this). I would avoid using the ON Verified action to do anything except set a flag, put your main actions in the body of the IPN event. It's tricky to debug here too as there is no browser output - I have successfully used the Joomla! Logger methods to dump data to a text file that I can then read.

Here's some logging code extracted from one of my actions that may help:
jimport( 'joomla.error.log' );
$this->log        =& JLog::getInstance( 'mollie.log.php' );
$this->logging    = true;
. . .
$this->addLogEntry( $query );
. . .
  /**
   * adds a log entry if logging is enabled
   *
   * @param string  $message message to log
   */
  function addLogEntry( $message )
  {
    if ( $this->logging ) {
      $this->log->addEntry( array( 'comment' => $message ) );
    }
  }


Bob
This topic is locked and no more replies can be posted.