Paypal Standard PDTHandler Error

1 week ago

When paying with PayPal the auto-return URL to the PDTHandler displays an internal error page. However, if I press F5 to refresh the page then the customer confirmation page is displayed.

The error within the logs is the following:
One or more errors occurred. (A task was canceled.)

System.AggregateException: One or more errors occurred. (A task was canceled.) ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Nop.Plugin.Payments.PayPalStandard.PayPalStandardPaymentProcessor.GetPdtDetails(String tx, Dictionary`2& values, String& response)
   at Nop.Plugin.Payments.PayPalStandard.Controllers.PaymentPayPalStandardController.PDTHandler()
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

I have set up the Paypal Standard plugin, entering the PayPal email and the PDT identity token taken from PayPal.

I have turned on 'Auto return' within PayPal and entered my PDT handler as such:

Payment data transfer has also been set to 'On' within PayPal.

I'm not really sure what the error is or how I should proceed with trying to fix this.

Any help or advice would be greatly appreciated.

1 week ago
What version nopCommerce and what version plugin ?
Was it working and just stopped working
or you are just trying to get it to work for first time ?
1 week ago
Hi Yidna,

PayPal standard is at version 1.55
nopCommerce is at version 4.20

It was working not long ago as I had tested this with live purchases and it was working.

1 week ago
Okay, looks like I found the issue.

The error was being thrown at
var response = await _httpClient.PostAsync(url, requestContent);

Essentially the request was timing out. I had a look at the httpClient and it is set to timeout after 5 seconds.
client.Timeout = TimeSpan.FromMilliseconds(5000);
It would appear that sometimes a timeout would occur and other times not, hence why it worked before and not now.

For now, I have increased the timeout and I'm getting no more errors.