Why did I get an exception error when retrieving user certificates with PayPal's Microsoft SDKs?

Issue
While working with the Microsoft SDKs from PayPal, you got the following error: "com.paypal.sdk.exceptions.FatalException: Unable to retrieve certificate from user or system keystores for: XXXXX."

Cause
The SDK throws an exception when the Certificate for your API account hasn't been registered properly on your system through the winhttpcertcfg utility.

The Microsoft SDKs use a Windows API to retrieve the correct certificate from the system keystore by referencing your API account username. In the error message "Unable to retrieve certificate from user or system keystores for: XXXXX," XXXXX would be the API username you set in your code or that you entered if using the SDK Console.

If you didn't use winhttpcertcfg to register your corresponding API Certificate on your system, you'll see this exception when you try to make an API call.

Solution
Use the winhttpcertcfg tool to register your certificate on your server. If you've already registered your certificate on your server, you may see this error if you're not specifying the correct API username. Check that you're using the correct API username for your account.

For explicit details on how to register your certificate with winhttpcertcfg, see the document How do I import my certificate into the Windows key store?