PayPal快速结帐:错误 10001 超时

本文关键字:错误 10001 超时 PayPal | 更新日期: 2023-09-27 17:56:23

所以我正在尝试实现PayPal Express结帐并不断收到上述错误。

我的NV如下:

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

显然,某些信息发生了变化。我找不到请求的任何特别错误,但始终返回 10001,并带有超时处理请求。

我希望这里有人以前遇到过这种情况并有解决方案。

编辑:下面是将请求放在一起并检索响应的代码:

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();
    }
}

贝宝的回应:

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

PayPal快速结帐:错误 10001 超时

>错误 10001 是未经处理的异常,这意味着没有更好的错误消息可用。

根据PayPal文档

您必须对请求中的所有请求字段值进行编码,以PayPal和 解码响应中的所有字段值。您必须编码和解码 个人价值观;不要对整个消息进行编码或解码。 浏览器经常尝试对以下消息进行编码和解码: 重定向到他们或从他们重定向;但是,您必须验证编码和 解码正确完成,并且仅对字段值进行解码。

它可能由于编码而发生。尝试摆脱它,看看是否有帮助。

这里的问题是使用开机自检。 只需删除req.Method = "POST"即可解决问题。