Why did I get the error "javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure error" with the Java SDK?

PayPal returned a fatal handshare failure error.

This error occurs when:

  • The axis.socketSecureFactory property was set incorrectly.
  • You set the wrong environment in the Java SDK.


Setting the axis.socketSecureFactory property
Check that the axis.socketSecureFactory property was set to com.paypal.sdk.core.DefaultSSLFactory before the Axis initialization. The PayPal Java SDK sets this property automatically using the following statement:

org.apache.axis.AxisProperties.setProperty("axis.socketSecureFactory", "com.paypal.sdk.core.DefaultSSLFactory");

If Axis is initialized outside the PayPal Java SDK, check that the property is correctly set in your initialization code.

Environment mismatch
Check that you set the correct environment in the SDK. For example, you used your Sandbox API username and password and certificate, but you set the environment to Live rather than Sandbox (or vice versa).