Http Error Code:417, Expectation Failed during merchant validation

I am trying to do merchant validation in Java. Before that, I completed these steps:-
  1. Registered Merchant Id, generated CSR, created merchant id and payment processing certificates.

  2. Registered and verified domain & allowed Https connection to sandbox IPs on port 443 and whitelisted IPs for domain verification.

  3. generated validation Url , using it to create ApplePay Payment Session.

Below is a snapshot of my code:
String file=classLoader.getResource("/merchant.p12").getFile();
FileInputStream fileN=new FileInputStream(file);
clientStore.load(fileN,keyStorePassword.toCharArray());

KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(clientStore, keyStorePassword.toCharArray());
KeyManager[] kms = kmf.getKeyManagers();

SSLContext sslContext = null;
sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(kms, null, new SecureRandom());

HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());

URL url= new URL(validationUrl);
HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);

urlConn.setRequestProperty( "Content-Type", "application/json" );
urlConn.setRequestProperty("Accept", "application/json");
urlConn.setRequestMethod("POST");

urlConn.connect();
JSONObject cred = new JSONObject();
cred.put("merchantIdentifier","com.merchant.mymerchantname");
cred.put("displayName", "test");
cred.put("initiative", "web");
cred.put("initiativeContext", mydomain);
OutputStream conn= urlConn.getOutputStream();
OutputStreamWriter wr = new OutputStreamWriter
(conn);
wr.write(cred.toString());
wr.flush();
StringBuilder sb = new StringBuilder();
int HttpResult = urlConn.getResponseCode();


Please help me with this as I am badly stuck.

Have you solve it? I'm having the same issue

Http Error Code:417, Expectation Failed during merchant validation
 
 
Q