# Test Payments showing Incomplete Transaction (CiviCRM 5.8.2)

While building out a transition plan from Drupal to Wordpress, after getting CiviCRM setup on Wordpress, I tried making a test contribution. However, all attempts resulted in Pending (Incomplete Transaction) despite showing as successful in the sandbox.

As part of troubleshooting, I tried making a test contribution on the production site (which is the one currently running Drupal) since I had previously made successful test contributions. However, this too lead to the contributions being marked as Pending (Incomplete Transaction).

One thing to note is that "Real" contributions have still been coming in fine on the production site.

I'm aware that there was an issue previously per this StackExchange post, however it appears that should have been fixed in 4.7.30, whereas I'm running 5.8.2 (both on the production and dev sites for obvious reasons).

No errors seem to be showing relating to this in any of the error_log files on the production or dev site.

Any further troubleshooting advice would be greatly appreciated.

I'm using Paypal Standard.

• Are you using Paypal Standard or Pro payment processor? – Pradeep Nayak Jan 5 '19 at 13:39
• I'm using Paypal Standard. Will update the post to reflect this. – jgillmanjr Jan 5 '19 at 17:23

Since you are using paypal standard then I believe it requires to setup IPN call back url for CiviCRM to get response from Paypal and process the contribution status.

Here is the document how to configure IPN(Instant Payment Notification) at Paypal.

HTH

• I've been focusing on addressing it from the dev side of things. Look at logs, it appears that the IPN for the test notification is getting blocked, which kind of makes sense. The notification URL that's showing in the sandbox is https://[domain]/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fpayment%2Fipn%2F2& So now to figure out how to resolve this – jgillmanjr Jan 6 '19 at 4:43
• The URL you build is wrong. Your url needs admin privileges. Try using Public facing url! – Pradeep Nayak Jan 7 '19 at 0:22

Based on your comment on Pradeep's answer, the issue now is the URL you're using. You can actually submit the IPN to any WordPress page that doesn't require a login. So assuming your front page doesn't require one, you can use: https://[domain]?page=CiviCRM&q=civicrm/payment/ipn/1. Of course, ensure that your payment processor id is 1 or change the last digit accordingly.

Also, note that you can resend IPNs for up to 30 days.

Alright, now that I've solved the problem, let me reiterate over the issues, and how they were solved.

# Problem 1: Wordpress Dev Site Test Contributions Marked Pending

Test contributions were being marked as Pending (Incomplete Transaction). As was identified via logs, and confirmed by looking at the IPN history for the sandbox, the notification URL was referencing the Wordpress backend.

As a result, I needed to figure out how to change this. As the docs state:

Enter your CiviCRM site home page (e.g. http://www.example.com) as the Notification URL. This is a placeholder. CiviContribute will pass the exact IPN 'listener' URL to PayPal automatically during each transaction.

## Solution

The solution required setting the $frontend argument to TRUE for the call to CRM_Utils_System::url as seen in CRM/Core/Payment.php (code reference). So instead of  protected function getNotifyUrl() {$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'], array(), TRUE, NULL, FALSE ); return (stristr($url, '.')) ? $url : ''; }  it's now  protected function getNotifyUrl() {$url = CRM_Utils_System::url(
'civicrm/payment/ipn/' . $this->_paymentProcessor['id'], array(), TRUE, NULL, FALSE, TRUE // This is the argument that needs to be added ); return (stristr($url, '.')) ? \$url : '';
}


For those interested, here's a link to the method definition.

Why I haven't seen this pop up elsewhere, I am not sure. It may be prudent to do a check, and if Wordpress or Joomla are being used, to set that argument.

After making that change though, notifications started flowing.

# Problem 2: Drupal Prod Site Test Contributions Marked Pending as Well

As mentioned in the initial post, test contributions also appeared to not be getting IPN notifications, where they used to previously.

## Solution

This was actually fixed while I was working on the fix for the Wordpress problem.

As it turns out, when I was initially testing with Wordpress, the relatively short order hits against the admin area by the IPN notifications caused modsec to blackball the IP that Paypal's Sandbox sends the notifications from.

Once I removed the IP from the deny list, the notifications resumed flowing, and the test contributions resumed processing correctly.