2012-03-02 82 views
2

我有一個貝寶交易,然後被授權然後被捕獲。我想用的refundtransaction .NET代碼退還它,我有以下錯誤: You can not refund this type of transaction錯誤10009退款授權交易

Public Function RefundTransactionCode(ByVal refundType__1 As String, ByVal transactionId As String, ByVal amount As String, ByVal note As String, ByRef resp As RefundTransactionResponseType) As AckCodeType 
     Dim caller As New CallerServices() 

     Dim profile As IAPIProfile = ProfileFactory.createSignatureAPIProfile() 
     ' 
     '   WARNING: Do not embed plaintext credentials in your application code. 
     '   Doing so is insecure and against best practices. 
     '   Your API credentials must be handled securely. Please consider 
     '   encrypting them for use in any production environment, and ensure 
     '   that only authorized individuals may view or modify them. 
     '    


     ' Set up your API credentials, PayPal end point, and API version. 
     profile.APIUsername = AppSettings("APIUsername") 
     profile.APIPassword = AppSettings("APIPassword") 
     profile.APISignature = AppSettings("APISignature") 
     profile.Environment = AppSettings("Environment") 
     caller.APIProfile = profile 
     ' Create the request object. 
     Dim concreteRequest As New RefundTransactionRequestType() 
     concreteRequest.Version = "51.0" 

     ' Add request-specific fields to the request. 
     ' If (amount IsNot Nothing AndAlso amount.Length > 0) AndAlso (refundType__1.Equals("Partial")) Then 

     Dim amtType As New BasicAmountType() 
     amtType.Value = amount 
     amtType.currencyID = CurrencyCodeType.CAD 
     concreteRequest.Amount = amtType 
     concreteRequest.RefundType = RefundType.Full 
     ' Else 
     'MsgBox(0) 
     'concreteRequest.RefundType = RefundType.Full 
     ' End If 
     concreteRequest.RefundTypeSpecified = True 
     concreteRequest.TransactionID = transactionId 
     concreteRequest.Memo = note 

     ' Execute the API operation and obtain the response. 
     ' Dim pp_response As New RefundTransactionResponseType() 
     resp = DirectCast(caller.[Call]("RefundTransaction", concreteRequest), RefundTransactionResponseType) 
     Return resp.Ack 

    End Function 
+1

這不是一個編碼錯誤,但更多的是與交易。我建議您通過https://www.paypal.com/mts/ – Robert 2012-03-02 00:41:45

回答

1

我會建議在您的PayPal賬戶找到交易,並看着它。這可能是授權,訂單,待處理交易或其他類型的交易。

您只能退還已發送到您代表*發送API的帳戶的拍攝/銷售,但尚未退款。


*

  1. 第三方API調用,在你與你的用戶名,密碼和簽名/證書一起使用「主體」在您的API參數,你送代表的API調用'主題的帳戶。
  2. 第一方API調用,你不送主題,並且只使用自己的API的用戶,傳球,和SIG/CERT
+0

與PayPal Merchant Technical Services聯繫,我的交易類型爲授權 – 2012-03-04 18:34:17

+1

您無法退還授權。您可以使其無效,但沒有資金被採納,因此不需要爲買方提供資金;買方已經'資助'了。只是爲了好玩,''''''''。 – SgtPooki 2012-03-05 17:52:31

+0

@khs,我希望接受我的答案是正確的答案。謝謝。 – SgtPooki 2012-11-07 17:53:09