I am moving from Payeezy to use the new Clover API's for a web based background task (no GUI or user interaction)
I can see how to process a transaction once I get the bearer token but I can't seem to get this first step in Java to work, for in the simple example below (clientid, secret is made up). What am I missing? Thanks for any pointers
String clientId = "9QBY5ZWD0FDFJM"; String clientSecret = "f94599b7-525a-###-##########"; HttpClient client = HttpClient.newHttpClient(); Gson gson = new Gson(); // Create JSON object JsonObject requestBody = new JsonObject(); requestBody.addProperty("client_id", clientId); requestBody.addProperty("client_secret", clientSecret); // Convert to JSON string String jsonBody = gson.toJson(requestBody); System.out.println("Sending: "+jsonBody); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://sandbox.dev.clover.com/v3/merchants/oauth")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(jsonBody)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); // Parse access token from JSON response String accessToken = parseAccessToken(response.body());