Paypal Express Checkout: error 10001 timeout

advertisements

So I'm trying to implement the Paypal Express checkout and keep recieving the above error.

My NV is as follows:

METHOD=SetExpressCheckout&
VERSION=204.0&
USER=mylogicn&
PWD=mypwd&
SIGNATURE=mysignature&
PAYMENTREQUEST_0_AMT=26.65&
PAYMENTREQUEST_0_CURRENCYCODE=GBP&
RETURNURL=https://www.example.com/Basket/NotificationProcessor.ashx?type=paypalsuccess&
CANCELURL=https://www.example.com/Basket/NotificationProcessor.ashx?type=paypalfailure&
PAYMENTREQUEST_0_PAYMENTACTION=Sale

Obviously with certain information changed. I can't find anything particularly wrong with the request but without fail always returns 10001, with Timeout processing request.

I'm hoping someone here has encountered this before and has a solution.

EDIT: Here's the code that puts together the request and retrieves the response:

string[][,] nv = new string[11][,]
{
    new string[,]{{"METHOD", "SetExpressCheckout" }},
    new string[,]{{"VERSION", "204.0" }},

    new string[,]{{"USER", "myuser"}},
    new string[,]{{"PWD", "mypwd"}},
    new string[,]{{"SIGNATURE","mysig"}},

    new string[,]{{"PAYMENTREQUEST_0_AMT", "26.65"}},
    new string[,]{{"PAYMENTREQUEST_0_CURRENCYCODE","GBP"}},

    new string[,]{{"RETURNURL",  "https://www.example.com/Basket/NotificationProcessor.ashx?type=paypalsuccess"}},
    new string[,]{{"CANCELURL", "https://www.example.com/Basket/NotificationProcessor.ashx?type=paypalfailure"}},

    new string[,]{{"PAYMENTREQUEST_0_PAYMENTACTION", "Sale"}},
    new string[,]{{"NOSHIPPING", "1"}},
};
string q = "?";
foreach(string[,] s in nv)
{
    q += s[0,0] + "=" + s[0,1] + "&";
}
q = q.TrimEnd('&');
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://api-3t.sandbox.paypal.com/nvp" + q);
req.Method = "POST";

HttpWebResponse response = (HttpWebResponse)req.GetResponse();
var encoding = ASCIIEncoding.ASCII;
if (response.StatusCode == HttpStatusCode.OK)
{
    using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
    {
        string response = reader.ReadToEnd();
    }
}

And Paypals response:

TIMESTAMP=2016%2d07%2d11T11%3a10%3a55Z&
CORRELATIONID=dcd0f848a9bb9&
ACK=Failure&
L_ERRORCODE0=10001&
L_SHORTMESSAGE0=Internal%20Error&
L_LONGMESSAGE0=Timeout%20processing%20request


Error 10001 is an unhandled exception that means there's no better error message available.

As per PayPal documentation

You must encode all request field values in a request to PayPal and decode all field values in the response. You must encode and decode individual values; do not encode or decode the entire message. Browsers often attempt to encode and decode messages that are redirected to or from them; however, you must verify that encoding and decoding is done correctly and only to field values.

it might happen due to encoding. Try to get rid of it and see if it helps.