0
我正在开发一种机制,即一次将资金转移到PayPal的多个账户中。它通过以下代码使用对MassPay API的调用(凭据是混乱的)。MassPay PayPal API安全错误
public static string TestMassPay()
{
//X509Certificate x509 = new X509Certificate("Certifcate Description");
X509Certificate x509 = null;
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(URL);
string postData = "METHOD=MassPay&EMAILSUBJECT=You+have+money!&RECEIVERTYPE=EmailAddress&CURRENCYCODE=USD&L_EMAIL0=mr.kaleemullah%40gmail.com&L_Amt0=1.00&L_UNIQUEID0=&L_NOTE0=&USER=ali_api1.sevdotcom.ae&PWD=TLPPC43GDDM9DKZ9&SIGNATURE=Are9-8DOFiZXJtjX-8nkuOpzmTl2AQTy0kHQ5oey6i4QxuaeJ0z-Amhk&VERSION=1&SOURCE=1";
objRequest.Timeout = TimeOut;
objRequest.Method = "POST";
objRequest.ContentLength = postData.Length;
if (null != x509)
{
objRequest.ClientCertificates.Add(x509);
}
using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
{
myWriter.Write(postData);
}
using (WebResponse response = objRequest.GetResponse())
{
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
string strResponse = sr.ReadToEnd();
NameValueCollection qscoll = HttpUtility.ParseQueryString(strResponse);
return strResponse;
}
}
}
它给了我下面我用Google搜索了错误很好,但没有发现任何错误
&L_LONGMESSAGE0=Security%20header%20is%20not%20valid
。
我想我需要提供有关我无法在文档中找到任何内容的安全证书的详细信息。 谢谢
我也使用EMAILSUBJECT不是主题属性,请检查我认为X509Certificate x509 = null;应该初始化,但我不知道哪个值 – LojiSmith
我会推荐使用http://paypal.github.io/#merchant的.Net SDK - 它有一个示例,向您演示如何执行MassPay:https: //github.com/paypal/merchant-sdk-dotnet/blob/master/Samples/PayPalAPISample/APICalls/MassPay.aspx.cs – Praveen