我有一个paypal交易,经授权然后被捕获。我想使用refundtransaction
的.net代码退款。我有以下错误:
You can not refund this type of transaction
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
答案 0 :(得分:1)
我建议您在PayPal帐户中查找该交易并查看该交易。它可能是授权,订单,待定交易或某种其他类型的交易。
您只能退还已经发送到您代表*发送API的帐户的捕获/销售,该帐户尚未退款。
*