Paypal Standard PDTHandler Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi,

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: https://www.mysite.co.uk/Plugins/PaymentPayPalStandard/PDTHandler

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.

Thanks.
4 years 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 ?
4 years 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.

Thanks.
4 years 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.

Thanks.
3 years ago
Hi,

It seems I am also facing this problem. I have recently setup a new store and am using paypal standard in sandbox mode. I get the same error as you but I can't find the timeout set in the code?

Where exactly did you change?

Using same version as you also.
3 years ago
Hi. Good find! Having the same issue. Which file exactly did you access to increase the timeout time?

callist wrote:
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.

Thanks.
3 years ago
Have a look at source\Plugins\Nop.Plugin.Payments.PayPalStandard\Services\PayPalStandardHttpClient.cs
3 years ago
Thanks you for this. I am running 3.50.

When I go into the Plugins folder, I see Payments.PayPalStandard. When I go into that folder, there is no "services". There is "Views" (folder) and several files but none are called "PayPalStandardHttpClient.cs"

If I go into the "Views" folder, I see another folder called "PaymentPayPalDirect". There is a "configure" CS file and a PaymentInfo CS file.

There are two files with similar names:
Nop.Plugin.Payments.PayPalDirect.dll
Nop.Plugin.Payments.PayPalDirect.dll.config

Yidna wrote:
Have a look at source\Plugins\Nop.Plugin.Payments.PayPalStandard\Services\PayPalStandardHttpClient.cs
3 years ago
Sorry I was refering to the latest source version.
Dont know about v3.5 I cannot see a timout in that code
3 years ago
OK. Thanks again!

Yidna wrote:
Sorry I was refering to the latest source version.
Dont know about v3.5 I cannot see a timout in that code
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.