【发布时间】:2018-11-15 10:19:01
【问题描述】:
我负责市场业务中的 Paypal 支付集成,我有一个严重的问题,希望任何人都有经验。
我们在 Java 中使用 ExpressCheckout 和 Merchantsdk 版本 2.15.122。我知道这不是最新的集成方式,但应该仍然可以正常工作。
我们正在应用标准方式,首先通过 PayPalAPIInterfaceServiceService.setExpressCheckout 创建支付令牌,然后将客户重定向到 Paypal,并通过 PayPalAPIInterfaceServiceService.doExpressCheckoutPayment 实际执行支付。
我不确定实施代码在这里是否有帮助,因为它已经运行了几个月,但是几天前开始出现一些令人不安的错误。 我们有多种情况,其中似乎存在某种连接或响应时间问题,导致请求重试。在执行最终 doExpressCheckoutPayment 时,我们在日志中看到读取超时,如下所示:
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
at com.paypal.core.HttpConnection.execute(HttpConnection.java:91)
...并且paypal sdk还记录了“Retry No : 1 ...”和“Retry No : 2 ...”,所以它似乎重试了两次。最后,付款似乎失败并出现以下错误:
com.paypal.exception.HttpErrorException: retry fails.. check log for more information
at com.paypal.core.HttpConnection.execute(HttpConnection.java:144)
at com.paypal.core.APIService.makeRequestUsing(APIService.java:177)
at com.paypal.core.BaseService.call(BaseService.java:265)
at urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService.doExpressCheckoutPayment(PayPalAPIInterfaceServiceService.java:1513)
at urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService.doExpressCheckoutPayment(PayPalAPIInterfaceServiceService.java:1465)
不幸的是,一些愤怒的客户联系了我们,他们似乎实际上在这些重试中被收费。有些客户甚至被收取两次费用,即每次重试一次。
有没有人遇到过此类错误,并且可以提供一些如何正确处理这些错误的见解?
提前感谢您的帮助!
更新 正如答案中正确指出的那样,Paypal 只收取一个令牌一次,由于客户在我们的平台上看到支付失败而重试,并且多次遇到相同的问题,因此发生了双重收费。所以多次收费不是问题,但我仍然想知道应该如何正确处理,或者其他 Paypal 用户是否也会发生这种情况。
【问题讨论】: