当前位置: 首页 > 知识库问答 >
问题:

Paypal Java SDK支付执行问题

劳星晖
2023-03-14

我正在尝试将Papal与我的SpringWeb服务集成。我指的是高级服务器集成,并使用此SDK创建支付示例。

这是我的客户端代码

<script src="https://www.paypalobjects.com/api/checkout.js">
</script>
<h1>Paypal Integration - Advanced Server Side Integration</h1>
<div id="paypal-button-container"></div>
<script>
// Render the PayPal button

paypal.Button.render({

    // Set your environment

    env: 'sandbox', // sandbox | production

    // Wait for the PayPal button to be clicked

    payment: function() {

        // Make a call to the merchant server to set up the payment

        return paypal.request.post('http://localhost:8080/api/createpayment').then(function(res) {
            console.log(res);
            return res.payToken;
        });
    },

    // Wait for the payment to be authorized by the customer

    onAuthorize: function(data, actions) {

        // Make a call to the merchant server to execute the payment

        return paypal.request.post('http://localhost:8080/api/executepayment', {
            payToken: data.paymentID,
            payerId: data.payerID
        }).then(function(res) {
            console.log(res);
            document.querySelector('#paypal-button-container').innerText = 'Payment Complete!';
        });
    }

}, '#paypal-button-container');
</script>

这是我的网络服务

@RequestMapping(value = "/executepayment", method = RequestMethod.POST)
        public @ResponseBody 
        Payment executePayment(HttpServletRequest request, HttpServletResponse response) {
            Map<String, String> map = new HashMap<String, String>();

            Payment createdPayment = null;
            try {

                final String clientID = "<clientId>";
                final String clientSecret = "<clientSecret>";
                // ### Api Context
                // Pass in a `ApiContext` object to authenticate
                // the call and to send a unique request id
                // (that ensures idempotency). The SDK generates
                // a request id if you do not pass one explicitly.
                APIContext apiContext = new APIContext(clientID, clientSecret, "sandbox");
                if (request.getParameter("payerId") != null) {
                    logger.info("Payment Execution");
                    Payment payment = new Payment();
                    if (request.getParameter("guid") != null) {
                        payment.setId(map.get(request.getParameter("guid")));
                    }

                    PaymentExecution paymentExecution = new PaymentExecution();
                    paymentExecution.setPayerId(request.getParameter("payerId"));


                    createdPayment = payment.execute(apiContext, paymentExecution);
                    logger.info("Executed Payment - Request :: \n " + Payment.getLastRequest());
                    logger.info("Exceuted Payment - Response :; \n " + Payment.getLastResponse());
                    //ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), Payment.getLastResponse(), null);

                    //ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), null, e.getMessage());

                }
            } catch (Exception e) {
                logger.error("Execute Payment Exception ");
                e.printStackTrace();
            }
            return createdPayment;
        }

当我点击Paypal结账按钮时。它弹出Paypal登录屏幕,授权工作正常。之后,我尝试使用我的API执行付款。但是当我呼叫付款时,我收到500内部服务器错误。执行(apiContext,paymentExecution)方法。这是完整的堆栈跟踪

[http-nio-8080-exec-42] ERROR com.paypal.base.HttpConnection - Response code: 500   Error response: <html><head><title>JBoss Web/7.0.17.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V    org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)  org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170)    org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)   org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V  com.paypal.foundation.security.InvalidInputDataException.&lt;init&gt;(InvalidInputDataException.java:11)    com.paypal.foundation.security.crypto.AbstractIdEncryptor.decrypt(AbstractIdEncryptor.java:81)  com.paypal.domains.common.utils.crypto.impl.IdCryptUtilImpl.decryptId(IdCryptUtilImpl.java:103) com.paypal.domains.payment.dal.dao.impl.PaymentsFacadeDAOImpl.findPaymentByEncryptedId(PaymentsFacadeDAOImpl.java:301)  com.paypal.domains.payment.bo.impl.PaymentBOFactory.getPaymentForRoutingCheck(PaymentBOFactory.java:340)    com.paypal.api.service.impl.PaymentServiceImpl.checkRoutingToSymphony(PaymentServiceImpl.java:2167) com.paypal.api.service.impl.PaymentServiceImpl.executePayment(PaymentServiceImpl.java:811)  sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke(Method.java:606)    org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)  org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)   org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerReque2017-05-03 17:48:33 ERROR UserController:740 - Create Payment Exception 
stFilter.java:76)   com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBoss Web/7.0.17.Final logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.17.Final</h3></body></html>
response-code: 500  details: null
    at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
    at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
    at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
    at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
    at com.paypal.api.payments.Payment.execute(Payment.java:226)
    at com.statementgames.controllers.UserController.createPayment(UserController.java:640)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at com.statementgames.filters.CORSFilter.doFilter(CORSFilter.java:54)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.paypal.base.exception.HttpErrorException: Response code: 500 Error response: <html><head><title>JBoss Web/7.0.17.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V    org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)  org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170)    org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)   org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: com.paypal.foundation.security.ObjectEncryptionException.&lt;init&gt;(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V  com.paypal.foundation.security.InvalidInputDataException.&lt;init&gt;(InvalidInputDataException.java:11)    com.paypal.foundation.security.crypto.AbstractIdEncryptor.decrypt(AbstractIdEncryptor.java:81)  com.paypal.domains.common.utils.crypto.impl.IdCryptUtilImpl.decryptId(IdCryptUtilImpl.java:103) com.paypal.domains.payment.dal.dao.impl.PaymentsFacadeDAOImpl.findPaymentByEncryptedId(PaymentsFacadeDAOImpl.java:301)  com.paypal.domains.payment.bo.impl.PaymentBOFactory.getPaymentForRoutingCheck(PaymentBOFactory.java:340)    com.paypal.api.service.impl.PaymentServiceImpl.checkRoutingToSymphony(PaymentServiceImpl.java:2167) com.paypal.api.service.impl.PaymentServiceImpl.executePayment(PaymentServiceImpl.java:811)  sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke(Method.java:606)    org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)  org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)   org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)  org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)    org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)  org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)   org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)   org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181)   org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)   javax.servlet.http.HttpServlet.service(HttpServlet.java:754)    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)  org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23)    com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)   com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBoss Web/7.0.17.Final logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.17.Final</h3></body></html>
    at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:162)
    at com.paypal.base.HttpConnection.execute(HttpConnection.java:65)
    at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:417)
    ... 45 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://api.sandbox.paypal.com/v1/payments/payment/706473799bd24b5792e463df41140a61/execute
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:132)
    ... 47 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://api.sandbox.paypal.com/v1/payments/payment/706473799bd24b5792e463df41140a61/execute
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:117)
    ... 47 more

我不知道出了什么问题。Paypal Java SDK或我的服务器端代码中是否存在任何问题。我做错什么了吗?


共有1个答案

莘羽
2023-03-14

这个错误是因为错误的付款Id。我只是将代码更改为

if (request.getParameter("paymentId") != null) {
    payment.setId(request.getParameter("paymentId"));
}

我认为Paypal应该处理这类错误,并在JSON响应中显示一些正确的错误消息,如缺少付款ID、无效付款ID或其他。收到500个内部服务器错误是很奇怪的,而且很难调试。

 类似资料:
  • 如何使用 PHP 自动PayPal付款? 我有我的PayPal企业帐户的电子邮件,收件人的PayPal电子邮件和要转移的金额。有没有办法在没有我互动的情况下进行汇款?(付款来自我的帐户) 当然我会手动运行PHP脚本

  • 我用贝宝支付预付我的Magento购物车。我发现一个来自加拿大的客户的信用卡不断下降。我直接和客户谈了一下,做了以下测试: > 转到我的Paypal管理器中的虚拟终端,只测试授权,它也不工作。虚拟终端的单个事务测试给出错误:结果代码:12响应消息:Decreded:15005-无法处理此事务。 我在我的贝宝账户里发了一张2美元的发票,但这也不起作用。 客户然后使用信用卡从其他地方和它的工作很好。然

  • wx.BaaS.pay(OBJECT) OBJECT 参数说明 参数 类型 必填 参数描述 totalCost Number Y 支付总额 merchandiseDescription String Y 微信支付凭证-商品详情的内容 merchandiseSchemaID Integer N 商品表 ID,可用于定位用户购买的物品 merchandiseRecordID String N 商品记录

  • 1.微信支付,扫描二维码报错? 登录到微信公众平台,进入微信支付,查看商户号有没有和公众号绑定关联。 2.微信支付,扫描二维码报错? 后台没有配置正确微信支付 ,商户号和签名串; 没有开通H5支付; 3.手机通过浏览器支付的时候显示,是什么原因? 在微信商户产品中心开通微信H5支付。 4.商城申请的微信H5支付已经通过了,但是手机浏览器支付的时候提示? H5里也需要单独提交域名。 5.微信支付配置

  • 1.微信支付,扫描二维码报错? 解决方案: 登录到微信公众平台,进入微信支付,查看商户号有没有和公众号绑定关联。 2.微信支付,扫描二维码报错? 解决方案: 1>后台没有配置正确微信支付 ,商户号和签名串; 2>没有开通H5支付; 3.手机通过浏览器支付的时候显示,是什么原因? 解决方案: 在微信商户平台产品中心开通微信H5支付。 4.商城申请的微信H5支付已经通过了,但是手机浏览器支付的时候提示

  • 1、新版支付宝支付配置 配置支付宝支付之前,需要到支付宝商家中心开通手机网站应用和电脑网站应用两个产品。 产品开通链接:快捷手机wap支付 电脑网站支付 一个工作日即可通过审核,完成产品签约。 接下来,介绍支付宝支付配置教程。 第一步 登录商城后台,设置->交易设置->支付配置 ,选择支付宝支付,点击配置,进入到支付宝支付参数配置界面,选择新版支付宝。 需要我们配置应用APPID、应用私钥、应用公