Search code examples
javapaypalsandbox

PAYPAL - get token sandbox


public void init(ServletConfig servletConfig) throws ServletException {

        try {

            OAuthTokenCredential tokenCredential = PayPalResource.initConfig(new File(PaypalServlet.class.getResource("sdk_config.properties").getPath()));
            accessToken = tokenCredential.getAccessToken();

        } catch (PayPalRESTException e) {

            LOGGER.fatal(e.getMessage());
        }catch (Exception e) {
            LOGGER.fatal(e.getMessage());
        }
    }

I am Using the above code for getting an access token. if i enter the paypal credentials it works fine. However if i change the credentials those of sandbox to test, access token is null. I have verified that the credentials for sandbox are right by using curl. is there anything i might be missing for testing with sandbox?


Solution

  • Pls check our server error logs and looking for SSL connection failures, it looks the underlying connection did not setup. (otherwise there should be an API error returned from PayPal)

    PayPal sandbox has been upgraded to accept TLSv1.2 only as the SSL connections protocol, so make sure your server environment components are compliant. Please see language specific checking instructions HERE