2013-03-19 132 views
0

enter image description here(不接收響應來自PayPal)與Asp.net我創建使用MassPaymentAPI MassPayment但我得到的錯誤在這種方法中貝寶集中付款API使用

輸入對於方法:::

url="https://api.sandbox.paypal.com/nvp" 
postdata="METHOD=MassPay&EMAILSUBJECT=You+have+money!&RECEIVERTYPE=EmailAddress&CURRENCYCODE=USD&L_EMAIL0=bhaumik50%40gmail.com&L_Amt0=1.00&L_UNIQUEID0=&L_NOTE0=&USER=rserasiya_api1.gmail.com&PWD=OneIsTheLonliestNumber&VERSION=1&SOURCE=1" ; 
timeout= "3600" ; 
X509certificate = "Certifcate Description" 


public static string HttpPost(string url, string postData, int timeout, X509Certificate x509) 

{ 

    HttpWebRequest objRequest = (HttpWebRequest) WebRequest.Create(url); 

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

     { 
      return sr.ReadToEnd(); 
     } 
    } 
} 

在這種方法中,我成功地發送請求使用StreamWriter對象,但我沒有得到貝寶網站的迴應,所以我該怎麼辦?請回復..

我的錯誤是:底層連接已關閉:連接意外關閉。

我把我的方法的圖像拋出錯誤和瀏覽器錯誤。

請給我你的建議 enter image description here

+0

我有相同問題。有沒有解決這個問題的方法? – 2013-09-04 21:00:15

+0

Rajnikant&Baris是否解答了您的問題?如果是的話,請將其標記爲寫回答並投票給我。 – 2013-12-10 12:38:35

回答

1

在你的代碼的問題是在API網址,你正在使用

url="https://api.sandbox.paypal.com/nvp" 

,而你應該使用

url="https://api-3t.sandbox.paypal.com/nvp"