Paypal Standard Gateway

Setup regarding PayPal Standard Implementation using IPN.

Info: When clicking the “send order” button, the customer gets redirected to the PayPal website, where he/she can pay as usual via paypal or credit card (order details etc will be passed onto paypal as appropriate).

When the payment has been successful – via an IPN call ( see below regarding IPN setup )- the same emails you and the customer would receive when using the COD gateway will be sent.
(as well as any emails paypal send themselves)

On returning to your site assuming the payment has been successful, the normal thank you page will be displayed. If the customer cancels the transaction, no emails will be sent.

I hope the above is understandable, but do feel free to ask any questions via the usual channels (email/forum/contact form)…..

 

 

Setup/Enable PayPal “Instant Payment Notifications” (IPN)

How to enable IPN in your paypal account

  • login to your paypal account and click on “Seller Preferences” (screenshot)
  • In the seller preferences click on “update” next to “Instant payment notifications” (screenshot)
  • In the following screen, make sure the Notification URL is set to “http://www.yourdomain.com/?wppizza-listener=paypalipn” and is enabled (screenshot)
  • If this is NOT the case, click on “Edit” and make the necessary adjustments (screenshot) and save
  • Note: the above screenhots still show the IPN as being “http://www.yourdomain.com/wp-content/plugins/wppizza-gateway-paypal/ipn/ipn.php”. Please ignore this if your version is 5.2+. From 5.2 onwards it should be http://www.yourdomain.com/?wppizza-listener=paypalipn as outlined above

If you still have issues, please also check the troubleshooting guide below

Troubleshooting

if you are on a STRATO server , please first read here , as Strato – in their infinite wisdom – might block paypal IPN requests !! (in short, de-activate “Sicherheit”-> “Server-side Security! ->”Filter gegen Gästebuch-Spam” if it is enabled)

If you have purchased and installed the gateway but have problems receiving orders by email, please check the following.

The most common issue is that IPN is not enabled in your Paypal account so no notifications are being sent back to your site, so first of all, please check the paypal guide here https://www.paypal.com/uk/smarthelp/article/why-didn’t-i-receive-any-ipn-posts-ts1006

If that does not help, please continue below.

 

i) make sure your site can and does receive IPN notifications from paypl. To check if this is the case:

go to http://yourdomain.com/?wppizza-listener=paypalipn in your browser.

You should just get a blank page. If you get anything else (like an access denied error, a 404/page not found page or you must login first to see that page due to some htaccess settings or some such) you must remove this restriction. (A 405 error is – probably – ok as the script expects POST’ed data)

If you have turned on logging, you might also now have an error log (ipn-errors-xxxxxx.log) with the following or similar text in it (only applicable for older versions of the paypal gateway pre wppizza v3.x):

[01-Jan-2013 16:49:34 UTC] Invalid HTTP request method.

This is ok as the script should only accept variables sent back by POST method from paypal. (see above)

If the above is as it should be and you still do not receive any emails, carry on.

 

ii) check your paypal email address

make sure that the email address entered is your PRIMARY email address associated with your paypal account (this will be verified to ensure the payment has not been tampered with)

 

iii) check your logfiles

– if you have any of the following files (ipn-fraud-warning-xxxxxx.log, ipn-transaction-successful-xxxxxx.log , ipn-not-verified-xxxxxx.log, ipn-errors-xxxxxx.log) in your my/wordpress/plugins/path/wppizza-gateway-paypal/logs/ directory (with wppizza v3.+ the path will be my/wordpress/plugins/path/wppizza/logs/), delete them (but leave .htaccess and index.html)

– if you have not done so yet, turn on “logging” under wppizza->gateways->paypal : “Logging ? (Y/N)” (for wppizza version 2.x, this will be automatically handled with wppizza v3.x)

– execute an order on your site using paypal

– have a look in your my/wordpress/plugins/path/wppizza-gateway-paypal/logs/ directory and check if any of the above mentioned logfiles have been generated .(in wppizza version 3.x , look in /plugins/wppizza/logs/)

– if there are no logfiles at all, IPN is not working or not setup correctly, goto iii) below

– if you an ipn-errors-xxxxxx.log that has anything other than “Invalid HTTP request method” (in case you ran the test under i) with logging enabled and you did not delete that file first), check and fix that error first.

– assuming the ipn-errors-xxxxxx.log is ok, you should have one ore more of the following logs (ipn-fraud-warning-xxxxxx.log, ipn-transaction-successful-xxxxxx.log , ipn-not-verified-xxxxxx.log). if you do not have any of these (again, assuming logging is enabled) something is wrong or not working correcly with your IPN setup in paypal (see iii))

– if you have a ipn-fraud-warning-xxxxxx.log or ipn-not-verified-xxxxxx.log , read what it says in them and fix the error(s).
please note: wppizza-gateway-paypal versions prior to 1.2 had a bug , that only displayed “array” in the ipn-fraud-warning-xxxx.log. if you have one of those old versions, please contact me at dev[@]wp-pizza.com with your purchase number and I will send new a new version of the gateway)
furthermore, versions previous to 1.2.1 made a very strict check that the emails setup with paypal, and the email setup in the gateway match. i.e [email protected] is different to [email protected]. Later versions of this plugin – 1.2.1+ are less strict about this).
So if you have one of the earlier versions, make sure the emails match exactly. (look for a line that says “receiver_email [email protected]” and make sure it matches exactly the email after “business [email protected]”)

– if you have a ipn-transaction-successful-xxxxxx.log , ipn is working ok and you should really have received the emails. please check your server error logs to see why emails were not sent (of course your server must be able to send emails in the first place. check – when using the COD gateway that emails are actually working)

 

iv) check paypal ipn settings

if – after you have enabled logging, having made an order using paypal and checked all the above – you still do not have ANY logfiles in your log directory. IPN is not working or not set up correctly.
so please check the following in your paypal account:

– login to paypal

– go to “history->ipn history” (something like cgi-bin/webscr?cmd=_display-ipns-history) you should see a screen similar to the following one (click image to enlarge)

ipn-04-adj

– if your transaction status messages say anything other than “sent” IPN is not sending notifications or not setup correctly. In which case click on “turn on IPN” at the top of the screen. If it is still not saying “sent” even after you have made sure IPN notifications are being set up correctly, it might well be the case that PayPal is not sending any IPN notifications due to problems their end. As this is nothing I have control over, you must *contact PayPal*. There is *absolutely nothing* I can do if this is the case.

Please note, as the ipn notification urls of the gateway get automatically generated, you might see that the transactions have been “sent” even though the IPN feature is turned off. However , if this is the case, something under ii) above should be the case already anyway)

– if IPN notifications are turned on, go to https://www.paypal.com/uk/cgi-bin/webscr?cmd=_profile-ipn-notify-edit and either set the “notification url” to http://yourdomain.com/?wppizza-listener=paypalipnp or select “Do not receive IPN messages (Disabled)” and blank out the “Notification URL”. (sometimes if you cannot blank out the url . if this is the case just leave it as is)
I know this is a bit counter intuitive, but having set here “Do not receive IPN messages (Disabled)” does not mean IPN is turned off, it only says that the automatically generated url will be used instead of the one set in “notification url”

– if this is all corrected now, go back to ii) and try ordering again and check if now logfiles get generated as described above

 

if you still have problems, please contact me at : dev[at]wp-pizza.com with the domain you are having problems with and please attach all your logfiles (if any) that reside under the gateway logs directory and ideally some screenshots of your settings at:
https://www.paypal.com/uk/cgi-bin/webscr?cmd=_profile-ipn-notify-edit
and
https://www.paypal.com/uk/cgi-bin/webscr?cmd=_display-ipns-history