Hi, I Need help with xpay token generation Visa In-App Provisioning


Hi, I Need help with xpay token generation Visa In-App Provisioning

I am getting error while calling this API: https://sandbox.api.visa.com/inapp/provisioning/cardData/applePay

Please see the following screenshots for my pre-request script using SOAP UI:




Here I'm providing the script: (JAVA)

String apiKey = "U0LUA8LF07B5TSAXAQ4E214o4SeQkhqXaApz9ZkscEpURbOrA";
        String sharedSecret = "i$hhG5-K@/6vbbJG-8oqj6-N}5wupGG-IAd+LMG/";
        String resourcePath = "inapp/provisioning/cardData/applePay";
        String queryString = "apiKey=" + apiKey;
        String requestBody = "{\n" +
                "  \"vCardID\": \"v-123-b25dd0af-2960-420b-8aaa-49b3e466c00f\",\n" +
                "  \"deviceCert\": \"adevicecert\",\n" +
                "  \"nonceSignature\": \"jD4Aphu+93N2wbBn\",\n" +
                "  \"nonce\": \"vXWJaBidcTLaJJCF\"\n" +

        System.out.println("START Sample Code for Api Key-Shared Secret (X-Pay-Token)");
        URL url = new URL("https://sandbox.api.visa.com/inapp/provisioning/cardData/applePay?" + queryString);

        HttpURLConnection con = (HttpURLConnection) url.openConnection();

        con.setRequestProperty("Content-Type", "application/json");
        con.setRequestProperty("Accept", "application/json");

        String xPayToken = generateXpaytoken(resourcePath, queryString, requestBody, sharedSecret);
        con.setRequestProperty("x-pay-token", xPayToken);

        int status = con.getResponseCode();
        System.out.println("Http Status: " + status);

        BufferedReader in;
        if (status == 200) {
            in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        } else {
            in = new BufferedReader(new InputStreamReader(con.getErrorStream()));
            System.out.println("Api Key-Shared Secret (X-Pay-Token) test failed");
        String response;
        StringBuffer content = new StringBuffer();
        while ((response = in.readLine()) != null) {


Error message: {"responseStatus":{"status":401,"code":"9159","severity":"ERROR","message":"Token Validation Failed","info":""}}

I'm tried to send a  request , but I keep getting an error message. I'm not sure what I'm doing wrong or where to start troubleshooting.
Has anyone successfully integrated the Visa In-App Provisioning API before? If so, can you share any tips or solution for clearing this error with an example.
Any help would be greatly appreciated. Thanks!