Hi,
I have successfully used PayPal redirect on previous forms but always sent the emails with the "on submit" event.
Now I'm trying to be more professional, and only send the confirmation emails if the PayPal transaction goes through.
I've read a lot in the forums about the IPN listener but just can't get it to work.
In the paypal redirect action, I:
[list]
set a notify_url=http://www.mysitename.org/index.php?option=com_chronoforms5&chronoform=myformname&event=ipn in the extra params
set sandbox mode to yes,
used my sandbox payment url
set a return url that is a page on my site (not the same as notify_url)[/list]
In the On IPN event, I have put a paypal listener action, setting it to sandbox mode, and with confirmation emails (one to user, one to the "office") in On Verified state. But those emails don't arrive. I am confused as to what I should put in On Invalid and On Error - if I put a display message, where would it get displayed? Or should I put some sort of email there?
Also, what am I supposed to see when I look at my notify_url http://www.mysitename.org/index.php?option=com_chronoforms5&chronoform=myformname&event=ipn It is a blank page (with only my website header).
When I look at the PayPal sandbox side, I do see completed transactions in the IPN listing. So it seems like something is sort of working...
I am stumped - any ideas on what I should try next?
Thank you so much!
Hi JerseyGirl,
a. I think that PayPal sandbox now requires that you have an HTTPS IPN url and hence a certificate on your site. (And PayPal live is switching over as well.) That may be the problem.
b. Add an Email action after the PayPal Listener action to check that the IPN event is actually being triggered.
Bob
a. Will let you know after we get ssl for this site if that was the only problem.
b. Email within the IPN event but not in the listener action also does not get through.
Thanks.
Hi Bob,
I now have ssl on this site so I changed the notify_url to be https://www.mysitename.org/index.php?option=com_chronoforms5&chronoform=myformname&event=ipn
Also, I assume you meant to move the Email action in the ipn event up before the PayPal listener action (not before the Email action)? I did that.
Progress, but not resolved yet - email inside the on ipn event and before the listener came through, and contained "[payment_status] => Completed" within the message (used the data dump you suggested).
But emails from the "On Verified" state did not arrive.
What should I try next - should I put something in the "On Invalid" or "On Error" states?
Thanks.
P.S. I also have an email before the PayPal redirect action, and that is coming through fine, but of course that is not the place I want the email to be...
Update - I added a second email in the ipn event but outside the listener, so now I have one both before and after the listener.
The email before the listener comes through. The one after the listener does not. (Nor do any emails get through from "On Verified," "On Invalid," or "On Error" from within the listener)
Any ideas? Thanks.
Hi JerseyGirl,
If the 'after' email is not being sent then I am guessing that there is some kind of a PHP Error in the PayPal Listener action. Diagnosing that can be tricky as you can't see the Debugger output.
If you are comfortable with PHP then I would probably edit the action file to disable chunks of the code and add some lines off debugger output that can be emailed (i.e. added to the $form->data array) to try to pin down where the problem is.
Which version of PHP are you running?
Bob
The version is PHP 5.6.29. Do I need to have PHP 7? It's still listed as beta by my hosting company.
I know a little PHP. I have created a few custom email templates, with some if/then logic and doing some computations... but editing the action file might be beyond my current capability. How would I access it - can I get at it from the Chronoforms interface? or my webhost file manager - if so, what file?
Thanks.
Update... I had forgotten to change the field about appending the IP address (in the "Advanced" tab) of the "On Verified" emails. Once I changed this to "No," the email "to the office" (a static email address) went through.
Still had trouble with the "to user" address, which is dynamic. I didn't realize you can't use the form field name for email address the way you can if the email is sent from the "On Submit" event. Once I changed it to payer_email (what PayPal returns), that email worked as well.
Now I have to figure out how to format these emails properly (I had just been testing with the default email template from Chronoforms, and some of the fields come back unpopulated). Do I need to write a custom code for paypal redirect and send all my fields to paypal? Will search the forums more and do more testing!
Thanks for your help.
Hi JerseyGirl,
What I do with PayPal is to save all the form data to a database table before sending the user to PayPal. I include in this a unique transaction identifier (a random string) that I also include in the data to PayPal. Then I can use the identifier when it is returned by PayPal to look up the saved record, gain access to the data there, update the record to show the payment status and then add what I need to the Email template.
Bob