Ok I commented out the sections for UE. I believe I got it right. I have attached the file wa-receipt.php if you wouldn't mind checking it?
I ran a test transaction and after the transaction completed in the PayPal frame the frame turned gray, but failed to advance to checkout_success.php
Can you tell me what happened? Where is the reference to checkout_success.php?