language-based SDKs
got the below error message:
java.util.concurrent.CompletionException: java.lang.NoSuchMethodError: ‘okhttp3.RequestBody okhttp3.RequestBody.create(byte, okhttp3.MediaType)’
SquareClient badClient = new SquareClient.Builder()
.environment(Environment.SANDBOX)
.accessToken(“ACCESS_TOKEN”)
.build();
CustomersApi customersApi = badClient.getCustomersApi();
Address bodyAddress = new Address.Builder()
.addressLine1(“500 Electric Ave”)
.addressLine2(“Suite 600”)
.addressLine3(“address_line_38”)
.locality(“New York”)
.sublocality(“sublocality2”)
.administrativeDistrictLevel1(“NY”)
.postalCode(“10003”)
.country(“US”)
.build();
CreateCustomerRequest body = new CreateCustomerRequest.Builder()
.idempotencyKey(“idempotency_key1”)
.givenName(“Amelia”)
.familyName(“Earhart”)
.companyName(“company_name2”)
.nickname(“nickname2”)
.emailAddress(“[email protected]”)
.address(bodyAddress)
.phoneNumber(“1-212-555-4240”)
.referenceId(“YOUR_REFERENCE_ID”)
.note(“a customer”)
.build();
customersApi.createCustomerAsync(body).thenAccept(result -> {
System.out.println("=============" + result.toString());
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});