Forums

Paypal Listener ipn always on invalid

cornelio 23 Mar, 2017
Hi,

my setup On IPN

On Verified:
1- custom code to insert the paypal variables in the db - result OK
2- mail with custom template i put the same paypal variable- result OK
3- custom code with simple html text with message OK VERIFIED - result d'ont show

On Invalid - custom code with simple html text with message - INVALID , please contact admin
On Error - custom code with simple html text with message - ERROR , please contact admin.



Question is:

why the response paypal ipn always returns page ON Invalid

thanks a lot
Cornelio
Max_admin 26 Mar, 2017
Hi Cornelio,

How do you receive the verified mail ? the ipn event should not be accesses by the browser, its a page which PayPal "only" should access, you should not set the "return url" to that page either.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 29 Mar, 2017
HI Max,
the problem that makes me crazy is:

-if I enter the code below on PayPalListener VERIFIED with Custom Code

<?php
$id_foto = $_POST['item_name'];
$txn_id = $_POST['txn_id'];
	
$db = JFactory::getDbo();
$sql = "INSERT INTO `#__cf_payments` (`item_number`,`txn_id`) VALUES ( '" .$id_foto. "','" .$txn_id. "') ";
$db->setQuery($sql);
$db->execute();
?>


the data correctly is saved to the DB;
..and I enter the code below always on PayPalListener VERIFIED on Email custom template
<?php
echo'<div>$_POST: '.print_r($_POST, true).'</div>';
  
?>


i receive correctly the email with all the paypal variables.


the question is:
why the Listener is positioned to INVALID?

I send you my account via PM?

Thanks a lot
Best Regards
Cornelio
Max_admin 29 Mar, 2017
Hi Cornelio,

If these verified actions are processed then how do you know that the "invalid" event is processed ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 29 Mar, 2017
Hi Max,
because if I put this
<?php
echo "<font color='red'>
On verified PayPal Listener: VERIFIED.
<br/><br/></font>";
?>
in custom code is not shown while the same code is shown on INVALID

and I put the same code on custom template email to INVALID but the email arrives empty, without the variable Paypal

Regards
Cornelio
Max_admin 29 Mar, 2017
Hi Cornelio,

This means that you access the ipn event address using the browser ?

If yes then this is wrong and should not be done, the ipn event should be accesses by PayPal only.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 29 Mar, 2017
Hi Max,

This means That You access the event ipn address using the browser?



This is the page after the redirect from paypal
http://www.ieraora.com/demophoto/index.php?option=com_chronoforms5&chronoform=shop_simple_cart&event=ipn


url set to the same on site paypal ipn

Best Regards
Cornelio
cornelio 30 Mar, 2017
Hi Max,

OK now I understand the note:

You should NOT add this notify url in the "return url" of the "PayPal Redirect" action, the IPN event is setup to run in the background by a call from PayPal, not using the user's browser.



the problem is that if I remove the Return URL than on the Paypal payment page does not appear the button to return to the store.

Best Regards
Cornelio
Max_admin 30 Mar, 2017
Hi Cornelio,

Just add any other url, like a url for an article or create a new form event and add the url to it.

If you download the new Chronoforms v6 and install it (it will install as a new extension) then you can test the demo PayPal form (click new) and check how the PayPal action is configured with multiple events.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 30 Mar, 2017
1 Likes
Great Max!
thank you very much for your patience.

certainly I try the new ChronoForms v6

Best Regards
Cornelio
cornelio 31 Mar, 2017
Hi Max,

PayPal Listener now works fine.


Now in Return URL Redirect PayPal I put a redirect page where I need to call some paypal variables like this
$ txn_id = $ _POST ['txn_id'];


how to do that?

Thank you very much
Cornelio
Max_admin 31 Mar, 2017
Hi Cornelio,

The return url now points to a form event or an article ? if its a form event then you can use {txn_id} if you are using v5, and {data:txn_id} if you are using v6.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 31 Mar, 2017
Hi Max,

yes,

The return url now points to a form event

but your suggestion does not work


callback variable I have to use as the query below
$query->where($db->quoteName('txn_id')." = ".$db->quote($txn_id));



Best Regards
Cornelio
Max_admin 31 Mar, 2017
Hi Cornelio,

you mean in PHP ? then you should use
$form->data["txn_id"]


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 01 Apr, 2017
Thanks Max,

but it is not what is needed.

screen1 = setting of Paypal Redirect

scrren2 = the page where I want to retrieve this variable.
$ txn_id = $ _POST ['txn_id']; 


It does not work if outside IPN?

Best Regards
Cornelio
Max_admin 01 Apr, 2017
Hi cornelio,

In the custom code inside "download_after_pay", please use this code:

<?php
pr($form->data);

this will list all the data returned by PayPal on the page after purchase.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 01 Apr, 2017
Hi Max,

the result is as follows
Array
(
    [option] => com_chronoforms5
    [chronoform] => shop_simple_cart
    [event] => download_after_pay
)


Best regards
Cornelio
Max_admin 01 Apr, 2017
Hi Cornelio,

You get this result after you complete a purchase and get redirected by PayPal back to your website ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 01 Apr, 2017
Hi Max,

Yes just like this.

Best Regards
Cornelio
Max_admin 01 Apr, 2017
Hi Cornelio,

Ok, I didn't expect this, but what do you need to do with the txn_id number ? if you want to store it or send it by email then maybe you can use it in the ipn event instead.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 01 Apr, 2017
Hi Max,
I said it before in this post. I have to use this variable
$ txn_id
and then reinsert in a query->where

if you want to store it or send it by email then maybe you can use it in the ipn event instead.



email sending and store in the db, if you look at the screen2, are already done.

Best Regards
Cornelio
cornelio 01 Apr, 2017
Hi Max,

I could do this On IPN event but
as I understand it in IPN event we can not stand HTML because the listener works in the background, is it?

Best Regards
Cornelio
Max_admin 01 Apr, 2017
Answer
Hi Cornelio,

In the ipn you can not "display" any thing to the user, but you can send an data in the email.

If you want to display the txn_id to the user on the website then its not possible in this case, but you can store the data in the database in the ipn, then send the data by email to the user, or let them load it later on the website.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 02 Apr, 2017
Hi Max,

OK. Now the understanding of how the Listener works is complete.

I solved changing approach.

ie inserting before the Email action and add code like this

but I have so much to your help. Thank you so much Max

Best Regards
Cornelio
This topic is locked and no more replies can be posted.