{"action":"closed","issue":{"url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/issues/158","repository_url":"https://api.github.com/repos/paypal/PayPal-Java-SDK","labels_url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/issues/158/comments","events_url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/issues/158/events","html_url":"https://github.com/paypal/PayPal-Java-SDK/issues/158","id":139275017,"number":158,"title":"Paypal java rest api integration issues ","user":{"login":"vignesh001","id":17721368,"avatar_url":"https://avatars.githubusercontent.com/u/17721368?v=3","gravatar_id":"","url":"https://api.github.com/users/vignesh001","html_url":"https://github.com/vignesh001","followers_url":"https://api.github.com/users/vignesh001/followers","following_url":"https://api.github.com/users/vignesh001/following{/other_user}","gists_url":"https://api.github.com/users/vignesh001/gists{/gist_id}","starred_url":"https://api.github.com/users/vignesh001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vignesh001/subscriptions","organizations_url":"https://api.github.com/users/vignesh001/orgs","repos_url":"https://api.github.com/users/vignesh001/repos","events_url":"https://api.github.com/users/vignesh001/events{/privacy}","received_events_url":"https://api.github.com/users/vignesh001/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/labels/documentation","name":"documentation","color":"f7c6c7"},{"url":"https://api.github.com/repos/paypal/PayPal-Java-SDK/labels/sdk-bug","name":"sdk-bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2016-03-08T13:14:27Z","updated_at":"2016-04-19T18:54:38Z","closed_at":"2016-04-19T18:54:38Z","body":"I have integrated paypal gateway with java rest api to my website \r\nsuccessfully.It went fine for some time, But unfortunately i got issue \r\nwhile getting access code now.I already raised ticket 2 times but i can not find out the problem excatly what causes the problem in integration. \r\n\r\nThanks in advance.\r\n\r\nYou can check my code here :\r\n\r\n```java\r\nMap<String, String> sdkConfig = new HashMap<String, String>();\r\nsdkConfig.put(\"mode\", \"sandbox\");\r\nSystem.out.println(\"--------------- Paypal Test -------------------\");\r\nString accessToken = new OAuthTokenCredential(\"<ClientID>\", \"<SecretKey>\").getAccessToken();\r\nAPIContext apiContext = new APIContext(accessToken);\r\napiContext.setConfigurationMap(sdkConfig);\r\n\r\nAmount amount = new Amount();\r\namount.setCurrency(\"USD\");\r\namount.setTotal(\"12\");\r\n\r\nTransaction transaction = new Transaction();\r\ntransaction.setDescription(\"creating a payment\");\r\n\r\nList<Item> itemList=new ArrayList<Item>();\r\nItemList items=new ItemList();\r\n\r\nItem item=new Item();\r\nitem.setName(\"Cart\");\r\nitem.setQuantity(\"1\"); \r\nitem.setPrice(\"12\");\r\nitem.setCurrency(\"USD\");\r\n//item.setSku(shoppingProduct.getUnit());\r\nitemList.add(item);\r\nitems.setItems(itemList);\r\ntransaction.setItemList(items);\r\ntransaction.setAmount(amount);\r\n\r\nList<Transaction> transactions = new ArrayList<Transaction>();\r\ntransactions.add(transaction);\r\nPayer payer = new Payer();\r\npayer.setPaymentMethod(\"paypal\");\r\n\r\nPayment payment = new Payment();\r\npayment.setIntent(\"sale\");\r\npayment.setPayer(payer);\r\npayment.setTransactions(transactions);\r\nRedirectUrls redirectUrls = new RedirectUrls();\r\nredirectUrls.setCancelUrl(\"cancel url\");\r\nredirectUrls.setReturnUrl(\"return url\");\r\npayment.setRedirectUrls(redirectUrls);\r\nPayment createdPayment = payment.create(apiContext); \r\n\r\nIterator<Links> links1 = createdPayment.getLinks().iterator();\r\nwhile (links1.hasNext()) {\r\n  Links link = links1.next();\r\n  if (link.getRel().equalsIgnoreCase(\"approval_url\")) {\r\n    request.setAttribute(\"redirectURL\", link.getHref());\r\n  }\r\n}\r\nrequest.setAttribute(\"response\", com.paypal.api.payments.Payment.getLastResponse()); \r\n\r\nString output=com.paypal.api.payments.Payment.getLastResponse();\r\nString redirectURL=null;\r\ntry {\r\n  JSONObject json=new JSONObject(output);\r\n\r\n  JSONArray links=json.getJSONArray(\"links\");\r\n\r\n  for(int i=0;i<links.length();i++ ){\r\n    JSONObject hrefObj=links.getJSONObject(i);\r\n    String str=hrefObj.getString(\"method\");\r\n    if(str.equalsIgnoreCase(\"REDIRECT\")){\r\n      redirectURL=hrefObj.getString(\"href\");\r\n    }\r\n  }\r\n} catch (JSONException e) {\r\n  e.printStackTrace();\r\n```\r\n\r\nError Log Information:\r\n-----------------------------\r\n```\r\ncom.paypal.exception.HttpErrorException: retry fails.. check log for more information\r\nat com.paypal.core.HttpConnection.execute(HttpConnection.java:139)\r\nat com.paypal.core.rest.OAuthTokenCredential.generateOAuthToken(OAuthTokenCredential.java:192)\r\nat com.paypal.core.rest.OAuthTokenCredential.generateAccessToken(OAuthTokenCredential.java:148)\r\nat com.paypal.core.rest.OAuthTokenCredential.getAccessToken(OAuthTokenCredential.java:126)\r\nat com.thendral.controller.ThendralController.paypalRequest(ThendralController.java:9549)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\nat java.lang.reflect.Method.invoke(Unknown Source)\r\nat org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)\r\nat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)\r\nat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)\r\nat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)\r\nat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)\r\nat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)\r\nat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)\r\nat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)\r\nat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)\r\nat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)\r\nat javax.servlet.http.HttpServlet.service(HttpServlet.java:624)\r\nat javax.servlet.http.HttpServlet.service(HttpServlet.java:731)\r\nat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)\r\nat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\r\nat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\r\nat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\r\nat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\r\nat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)\r\nat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)\r\nat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)\r\nat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)\r\nat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)\r\nat org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)\r\nat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)\r\nat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)\r\nat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)\r\nat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)\r\nat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)\r\nat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\nat java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\nat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\r\nat java.lang.Thread.run(Unknown Source)\r\n```"}}