我正在尝试将 Paypal 退款集成到我们的网络应用程序中。我们使用的是经典 API 的非常旧的版本 (v 2.3)。它正在用于授权和捕获付款。以下是一些细节:
在沙盒账户上,付款状态始终处于待处理状态,永远不会完成。 当我尝试使用全额或部分退款时,我执行 ACK = success 并带有相关 ID,但沙箱门户上没有显示任何内容。这是我用来退款的代码。
'build the request string to process one paypal refund
pp = "&METHOD=RefundTransaction"
pp = pp & "&TRANSACTIONID=" & transactionId
pp = pp & "&REFUNDTYPE=PARTIAL"
pp = pp & "&AMT=" & Math.Round(amount, 2)
pp = pp & "&CURRENCYCODE=USD"
pp = pp & "&NOTE=Refund " & refundRow("Store") & "Order " & refundRow("OrderNo").ToString
我收到了回复,内容是这样的:
回复内容:
构建13443xxx
2.3 版
确认成功
时间戳 2014-10-23T16:44:36Z
CORELATIONID exxxx7e2dxxxx
我总是获得成功,但当我登录沙盒门户时什么也没有显示。
我还在现场网站上测试了几次退款。它有完全相同的问题。
有什么意见吗?
部分退款请求和响应
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" >
<soapenv:Header>
<ns:RequesterCredentials>
<ebl:Credentials>
<ebl:Username>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</ebl:Username>
<ebl:Password>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</ebl:Password>
<ebl:Signature>XXXXXXXXXXXXXXXXXXXXXXXXXXXX</ebl:Signature>
</ebl:Credentials>
</ns:RequesterCredentials>
</soapenv:Header>
<soapenv:Body>
<ns:RefundTransactionReq>
<ns:RefundTransactionRequest>
<ns:TransactionID>O-XXXXXXXXXXXXXXXXXXXXXXXXXXXX</ns:TransactionID>
<ns:RefundType>Partial</ns:RefundType>
<ns:Amount currencyID="USD">7</ns:Amount>
<ebl:Version>94.0</ebl:Version>
</ns:RefundTransactionRequest>
</ns:RefundTransactionReq>
</soapenv:Body>
</soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI">
<SOAP-ENV:Header>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType">
</Security>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username xsi:type="xs:string">
</Username>
<Password xsi:type="xs:string">
</Password>
<Signature xsi:type="xs:string">
</Signature>
<Subject xsi:type="xs:string">
</Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body id="_0">
<RefundTransactionResponse xmlns="urn:ebay:api:PayPalAPI">
<Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2014-10-25T06:07:08Z</Timestamp>
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
<CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">45xxxxxxxxxxx</CorrelationID>
<Version xmlns="urn:ebay:apis:eBLBaseComponents">94.0</Version>
<Build xmlns="urn:ebay:apis:eBLBaseComponents">1xxxxx4</Build>
<RefundTransactionID>
</RefundTransactionID>
<TotalRefundedAmount xsi:type="cc:BasicAmountType" currencyID="USD">-7.00</TotalRefundedAmount>
<RefundInfo xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:RefundInfoType">
<RefundStatus xsi:type="ebl:PaymentStatusCodeType">None</RefundStatus>
<PendingReason xsi:type="ebl:PendingStatusCodeType">none</PendingReason>
</RefundInfo>
</RefundTransactionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
好的,我在 PayPal 技术支持团队的帮助下解决了这个问题。
基本上有两种类型的交易 ID。一个是我们调用 DoAuthorize 时得到的,另一个是我们调用 DoCapture 时得到的。所有退款均可通过后者(DoCapture)交易 ID 进行。
帮助链接: https://developer.paypal.com/docs/classic/express-checkout/ht_ec-orderAuthPayment-curl-etc/
虽然我已经有了答案,但我对当我们使用 DoAuthorize 调用中的交易 Id 调用 RefundTransaction API 时得到的响应不是特别满意。我返回成功???并且还有一个关联 ID。但帐户中什么也没有显示。
PayPal 技术团队,如果您偶然发现这篇文章,请他们纠正问题或解释为什么它有意义。