Posted: October 31, 2013 at 9:43 am
|
I’ve been reading up on this common problem but I’m still getting this problem despite trying the fixes you’ve listed. I’ve reset the permissions on the log file, I’m getting transactions and logs no problem. The site seems to work generally well and Paypal works fine. payments can be made in Sandbox mode and Live mode fine. However, on the transaction page in Live mode the Payments are still being marked as Incomplete. If I leave that page for a minute then hit the refresh button – the status changes to Complete and the registration is confirmed. Sandbox mode works straight away. So is something being slow ? How can I fix this!? Thanks, |
Hi Nick, It’s becoming more of a problem recently because it appears that the Instant Payment Response times from PayPal are varying much more than they used to. What happens is the payer returns from PayPal to your site *before* the IPN gets sent from PayPal. At this point we are not sure what is causing the delay. In the past the delay was happening on the transactions shortcode page (the receiving end), and installing the simplified page template worked quite well to speed up the Instant Payment Notification on the receiving end. However it appears now that the Instant Payment Notification isn’t getting sent from PayPal right away. In our testing we’ve seen the IPN get received up to a minute *after* the Thank You page loads up. The idea that we’re testing now that seems to work well is add a check to see if the IPN has been received yet. If it hasn’t been received yet once the Thank You page is loaded up it will set the Payment status as Pending. Here’s a link to the code that adds this check: |
|
|
As always thanks Josh but the problem is now. When eventually the IPN has completed/received. My registrant won’t receive the emails, become confirmed, etc ? or is this something done behind the scenes ? |
|
oh and that code does not seem to have worked – I’ve replaced line 24 but the page still returns as Incomplete. |
|
in fact it appears to be ignoring my entire /uploads/espresso/gateways/paypal template! |
|
Yep – paypal_ipn.php is being completly ignored in the uploads/ path. Any help ? |
|
I’m just confused, I put the code from GitHub but it just doesn’t work. I thought about even adding a sleep(6); but that doesn’t have any effect. Need some help asap! <code>function espresso_process_paypal($payment_data) { do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $payment_data['txn_type'] = 'PayPal'; $payment_data['txn_id'] = 0; $payment_data['payment_status'] = 'Incomplete'; $payment_data['txn_details'] = serialize($_REQUEST); include_once ('Paypal.php'); $myPaypal = new EE_Paypal(); echo '<!--Event Espresso PayPal Gateway Version ' . $myPaypal->gateway_version . '-->'; $myPaypal->ipnLog = TRUE; $paypal_settings = get_option('event_espresso_paypal_settings'); if ($paypal_settings['use_sandbox']) { $myPaypal->enableTestMode(); } if (empty($_POST['ipn_track_id']) && ($_POST['payment_status'] == 'Completed' || $_POST['payment_status'] == 'Pending')) { $payment_data['txn_details'] = serialize($_POST); $payment_data['txn_id'] = $_POST['txn_id']; $payment_data['payment_status'] = 'Pending'; } elseif ($myPaypal->validateIpn()) { $payment_data['txn_details'] = serialize($myPaypal->ipnData); $payment_data['txn_id'] = $myPaypal->ipnData['txn_id']; if ($myPaypal->ipnData['mc_gross'] >= $payment_data['total_cost'] && ($myPaypal->ipnData['payment_status'] == 'Completed' || $myPaypal->ipnData['payment_status'] == 'Pending')) { $payment_data['payment_status'] = 'Completed'; if ($paypal_settings['use_sandbox']) { // For this, we'll just email ourselves ALL the data as plain text output. $subject = 'Instant Payment Notification - Gateway Variable Dump'; $body = "An instant payment notification was successfully recieved\n"; $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; foreach ($myPaypal->ipnData as $key => $value) { $body .= "\n$key: $value\n"; } wp_mail($payment_data['contact'], $subject, $body); } } elseif(in_array($myPaypal->ipnData['payment_status'],array( 'Refunded', 'Reversed','Canceled_Reversal')) ){ /*$subject = 'Payment Refund Notice from PayPal'; $body = "A payment has been refunded or reversed:\n"; $body .= "Payer's Email: " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; foreach ($myPaypal->ipnData as $key => $value) { $body .= "\n$key: $value\n"; } $body .= "Event Espresso does not handle payment refunds automatically. You will want to verify that the registration for this user has been cancelled here ".site_url()."/wp-admin/"; wp_mail($payment_data['contact'], $subject, $body);*/ die; }else { $subject = 'Instant Payment Notification - Gateway Variable Dump'; $body = "An instant payment notification failed\n"; $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; foreach ($myPaypal->ipnData as $key => $value) { $body .= "\n$key: $value\n"; } wp_mail($payment_data['contact'], $subject, $body); } } //add_action('action_hook_espresso_email_after_payment', 'espresso_email_after_payment'); return $payment_data; } </code> |
Hi Nick, What you do is make the change in wp-content/plugins/event-espresso/gateways/paypal/paypal_ipn.php. Then copy over the entire /paypal/folder to /wp-content/uploads/espresso/gateways to prevent your changes from being overridden on an update. With the emails not firing: If it’s set to send emails after payment I don’t think the PayPal IPN can be relied on. I’ve read in PayPal’s docs that they more or less say the IPN can’t be relied on for being an instant notification. So if you’re using the PayPal IPN and you need the confirmation email to go out then at this time I can advise setting the email settings to go out before payment. A good alternative to PayPal that’s worth looking into is Stripe. There is no delay with Stripe’s API. |
|
The support post ‘Paypal – Paid but Incomplete Transaction’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.