Buy Now
Sign in

Paypal Listener FULL, "fails" dont work.

jhaviro , June 05 at 18:00
j
jhaviro

Good afternoon.

After several tests, I bought the license for the Full Paypal Plugin, but I have a problem and several questions:

1. With the Paypal Listener I only get correct results (sandbox) when the submission is "complete" but no results in the "on error" and "on novalid"

2. In the event (listener Paypal) "on verified" I have a "DB read" action that works correctly, the model is "Data142" how can I access the data read. For the moment I have achieved this:

				
<table style="width:70%; font-family:Arial, Helvetica, sans-serif; border:#CCC 1px solid">
<th colspan="2" style="padding-top:5px; padding-bottom:5px; font-size:16px; background:#CCC;"><strong> -www.traductores.com- </strong></th>
<?php
echo '
<tr><td colspan="2" style="padding-top:5px; padding-bottom:5px; font-size:16px; background:#CCC; text-align:center"><strong>'.$form->data["Data142"]["titulopedido"].'</strong></td></tr>
<tr><td colspan="2" style="padding-top:5px; padding-bottom:5px; font-size:12px; background:#CCC; text-align:center"><strong>Estado Pedido: '. $_POST["payment_status"].'</strong></td></tr>
<tr><td>Fecha: </td><td>'.$_POST["payment_date"].'</td></tr>
<tr><td>Num. ID pedido: </td><td>'.$_POST["custom"].'</td></tr>
<tr><td>Nombre: </td><td>'.$form->data["Data142"]["name"].'</td></tr>
<tr><td>Apellidos: </td><td>'.$form->data["Data142"]["lastname"].'</td></tr>
<tr><td>Email: </td><td>'.$form->data["Data142"]["email"].'</td></tr>
<tr><td>Factura Paypal </td><td>'.$_POST["invoice"].'</td></tr>
<tr><td>Factura Paypal </td><td>'.$form->data["Data142"]["importe"].' €</td></tr>
<tr><td>Num. Verificación </td><td>'.$_POST["invoice"].'</td></tr>
<th colspan="2" style="padding-top:5px; padding-bottom:5px; font-size:12px; background:#CCC">Rios Rosas, nº 55 - local - (esquina Modesto Lafuente) 28003 Madrid - (España)<br/><strong>Tel: 34 915 353 671</strong></th>
</table>'
?>


For the "IPN" variables I access "$ _POST ['payment_status'];" (Example) and for the variables read in the table - $ form-> data ["Data142"] ["name"] (example) is there any better way to do it?

Thanks!!
Javierp

admin

Hi Javierp,

#1- you can check the data returned by PayPal by using an email action and setting the email body to
<?php pr($form->data); ?>

#2- The way you access the data now is fine.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

j
jhaviro

Goodnight.

I have a Email action inside the listener in the event "on invalid" and also in the event "on error". I have placed the code that I have been advised "<?php pr ($ form-> data);?>" Inside the template in both cases. I have tried to cause an error or not finish the purchase. I do not receive any kind of mail (even without php, either). I have tested from the IPN Simulator with ALL possible variables, it only works "Completed" The rest there is no way. I have tried from Express Checkout, Cart Checkout ... each with ALL error possibilities ... And I can not get any return emal.

Thanks for your help.
Javierp.

admin

Hi Javier,

I don't think that PayPal reports an incomplete purchase, if the user quits then PayPal does nothing.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

j
jhaviro

Good Morning.

It may not send any errors when closing, but there are many situations in which SI should fail:
- From the application: IPN simulator It should offer some kind of error.
- If the user does not have Paypal, they offer the option to pay with card, to the Paypal account of the Client.

The listener has 2 options, error and not valid ... what do they serve then? What variables do you expect to come from the IPN?

Cordially
Javierp.

GreyHead

Hi Javierp,

The 'Error' event is triggered if there is no response to a query from the action to PayPal - I guess this might happen if PayPal is off-line for some reason.

The 'Invalid' event is triggered if PayPal responds but that response from does not include 'VERIFIED'.

I suggest that you add a check of your own by saving the form data before redirecting to PayPal, include a transaction identifier e.g. an invoice number in the IPN URL and then in the Listener re-load the matching record and check that the key details e.g. the amount, etc. are correct.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

j
jhaviro

Good afternoon.

In the form, I send a "custom" variable that corresponds to the ID of the Form Saved in the Table. Then, in the event "On Verified" I again receive the variable to update the table with a new "confirmed" data. That is, if there were any errors, my table would not be updated. Thanks for your suggestion, I will also check the total amount.

I am reading at

				https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNImplementation/
				

Important: Use HTTPS to post verifications messages to PayPal. PayPal no longer supports HTTP for post backs. For full details, see the IPN Verification Postback to HTTPS Microsite.



Can this be the problem? Do I need to install an SSL certificate to receive the variable "INVALID"?

Thanks
javierp.

admin

Hi Javier,

No SSL is required on your website, if its needed then you would not receive the data from PayPal in the first place, but it's surely better to have a certificate installed to exchange the data more securely.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

GreyHead

Hi Javier,

I think that Max may be wrong here - PayPal are changing the requirements shortly (on June 17) for the live site but I think that the SandBox has required an SSL certificate for a while now. This LiquidWeb FAQ has a diagnostic that you can use.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

j
jhaviro

Good morning.

It is quite strange, if I get "completed" I should receive the "not valid" event. But indeed, Sandbox needs SSL. My site is still in testing and I do not have the associated domain so I can not install the Certificate. I will wait to do the final tests when I pass the web to production.

I have seen in the Listener code, that the event "error" only appears if it does not connect with Paypal, the event "novalid" should work whenever Paypal responds something other than "verified".

I will create a switch code on my form to register all variables in "payment_status":
- Completed, Canceled_Reversal, Created, Denied, Expired, Failed, Pending, pending_reason, Refunded, Voided, Reversed, Processed and Voided.

For the moment I see that the problem has no solution.
I thank you for your support. We will try SSL and talk.

(Anyway, I still consider that there is a problem with the event "novalid" and "error") ;)

A greeting!
Javierp

j
jhaviro

Goodnight.

Well I found a possible solution but I do not know if I should do this.
I have modified the Listener because, really, I do not need "novalid" event, what I need is to recover the actual state of the purchase process. Then, I can create a Switch, retrieve each variable and decide when to send an email.

I have modified in the file: administrator/components/chronoform/actions/paypal_listener/paypal_listener.php

this function:

				
*function set_events($valid = false, $form){
      if($valid){
         if($form->data['payment_status'] == 'Completed'){
            $this->events['verified'] = 1;
         }
      }else{
         $this->events['invalid'] = 1;
      }
   }


I've changed it for

				
function set_events($valid, $form){
      $this->events['verified'] = 1;
   }


Now, I always get the variable of payment_status ... then I'll handle it myself. It is not a "very clean" solution but I do not have much programming idea either.

If there is another way to do it or some way to activate the event "novalid" I would be very grateful for the help.

Thank you very much.
Javierp.

admin

Hi Javier,

Nice solution, so now you get a message from PayPal when the user cancels the payment ? or this is still not possible ?

Which payment status do you check beside "Completed" at the moment ?

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

j
jhaviro

Good afternoon.

If the user cancels the payment, I believe that the IPN variable "payment_status" sends "Canceled_Reversal" and the event "on IPN", it updates the order status (so I have it). This means that the user PAYS the order and then CANCEL.

If the user does not finish the payment, closes the payment gateway or ends abruptly, the status of the order is "empty" ... This means that it is not completed. I could add a custom status "not completed" and save it.

Right now, in your event "onvalid" I recover all the possible states of the payment:
Canceled_Reversal, Completed, Created, Denied, Expired, Failed, Pending, Refunded, Reversed, Processed, Voided

The result "completed" I continue collecting it and update the status of my order. The only thing I have done is to undo the chronoform event "on invalid" because it did not work.
That is, before, "completed" triggered the event "novalid" (which does not work) ...

I recommend updating and reviewing the code. It does not make much sense to have a "invalid" event if it does not work. It is possible that I am confused, but I have not been able to make it work.

				$this->events['invalid'] = 1;
				


This event is the one that does not work

Sincerely;
Javierp

admin

Hi Javier,

Thank you for the clarification.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!