Apple pay web authentication failed (SSL connection)

I have setup the server settings TLS, HTTPS

I have performed the following steps but not working for me:

1. I have validated my domain

2. Generate Certificate Signing Request (CSR) using keychain. It created public and private key in MAC keychain

3. Uploaded CSR (from point 2) to apple Pay Merchant Identity Certificate. It gave me merchant_id.cer

4. Generated .p12 with merchant_id.cer, public and private key using keychain

Now I am using this .p12 to create the ApplePaySession (paymentSession) using server side code in C# but getting error from apple side.

Exception: The SSL connection could not be established

Inner Exception: Authentication failed, The credentials supplied to the package were not recognized at System.Net.SSPIWrapper.AcquireCredentialsHandle

Sample Code:


var request = new MerchantSessionRequest()
{
    DisplayName = "StoreName",
    Initiative = "web",
    InitiativeContext = "applepaypoc.xxxxxx.com",
    MerchantIdentifier = "merchant.com.xxxxxx.applepaypoc",
};
string certPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\files", "NewP12.pfx");

X509Certificate2 certificate = new X509Certificate2(certPath, "xxxxx");

HttpClientHandler handler = new HttpClientHandler();
handler.ClientCertificates.Add(certificate);
handler.SslProtocols = System.Security.Authentication.SslProtocols.Tls12;

var resCode = string.Empty;

using (HttpClient client = new HttpClient(handler))
{
    try
    {
        HttpResponseMessage response = await client.PostAsJsonAsync(request.ValidationURL, validationPayload);

        response.EnsureSuccessStatusCode();

        resCode = response.StatusCode.ToString();

        string responseBody = await response.Content.ReadAsStringAsync();
        return responseBody;
    }
    catch (HttpRequestException e)
    {
        return $"resCode = {resCode} ///// Response Message: {e.Message} ///// Response Inner Exception: {e.InnerException.Message}";
    }
}

**Ref: **

https://developer.apple.com/documentation/technotes/tn3103-apple-pay-on-the-web-troubleshooting-guide

https://tech.justeattakeaway.com/2016/10/10/bringing-apple-pay-to-the-web/

It's a request

var request = new MerchantSessionRequest() { DisplayName = "StoreName", Initiative = "web", InitiativeContext = "applepaypoc.xxxxxx.com", MerchantIdentifier = "merchant.com.xxxxxx.applepaypoc", };

validationPayload
Apple pay web authentication failed (SSL connection)
 
 
Q