2014-10-09 40 views
1

我正嘗試從PayPal下載交易記錄。爲此,我致電TransactionSearch獲取日期範圍內的基本交易清單。然後我打電話GetTransactionDetails以獲取每筆交易的全部詳細信息。PayPal Classic API驗證一個電話,但不是下一個

 using (var client = new PayPalService.PayPalAPIInterfaceClient()) 
     { 
      var credentials = new PayPalService.CustomSecurityHeaderType 
      { 
       Credentials = new PayPalService.UserIdPasswordType 
       { 
        Username = "MyUserName", 
        Password = "MyPassword", 
        Signature = "MySignature" 
       } 
      }; 

      TransactionSearchReq request = new TransactionSearchReq(); 
      request.TransactionSearchRequest = new TransactionSearchRequestType(); 
      request.TransactionSearchRequest.StartDate = DateTime.Now.AddHours(-12); 
      request.TransactionSearchRequest.EndDate = DateTime.Now; 
      request.TransactionSearchRequest.Version = "117.0"; 

      TransactionSearchResponseType transactionSearchResponseType = client.TransactionSearch(ref credentials, request); 
      foreach (PaymentTransactionSearchResultType t in transactionSearchResponseType.PaymentTransactions) 
      { 
       var reqType = new GetTransactionDetailsRequestType 
       { 
        TransactionID = t.TransactionID, 
        Version = "117.0" 
       }; 
       reqType.DetailLevel = new DetailLevelCodeType[1]; 
       reqType.DetailLevel[0] = DetailLevelCodeType.ReturnAll; 

       var treq = new GetTransactionDetailsReq 
       { 
        GetTransactionDetailsRequest = reqType 
       }; 
       GetTransactionDetailsResponseType transaction = client.GetTransactionDetails(ref credentials, treq); 
      } 

     } 

第一次致電TransactionSearch的電話會返回一個交易清單。到GetTransactionDetails第二次調用返回一個錯誤:

Error Code: "10002" 
Long Message: "You do not have permissions to make this API call" 
Short Message: "Authentication/Authorization Failed" 
Correlation ID: 67970b9729a82 
Ack: Failure 
Build: 000000 
Version: "117.0" 
Any: null 
PropertyChanged: null 

我有三重檢查,我傳入呼叫TransactionId是我的有效交易之一,它是。

有沒有人見過這個?

+0

您可以發佈PayPal的完整回覆,包括相關ID嗎? – Eshan 2014-10-09 12:09:05

+0

@Eshan謝謝你的迴應。我在帖子中增加了更多內容。 – Fred 2014-10-09 12:17:52

+0

我試圖檢查我與這個相關ID,但無法找到太多。您可以在www.paypal.com/mts上提交一張門票並在此處將我的門票發給我。 – Eshan 2014-10-09 23:15:18

回答

1

看來,一些如何證書沒有被傳遞給你的代碼給定的變量。請確保以下變量包含值:

用戶名= 「MyUserName輸入」, 密碼= 「MyPassword輸入」, Sgnature = 「MySignature」

您可以硬編碼的API證書,然後嘗試。