Map<String, Object> data = new HashMap<>();
data.put("amount", 1);
data.put("callbackURL", "https://your.callback.url");
data.put("remark", "this is remark");
Gson gson = new Gson();
RequestBody body = RequestBody.create(gson.toJson(data), MediaType.parse("application/json; charset=utf-8"));
String token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBQjAwMDAwMDA0OTUiLCJhdWRpZW5jZSI6bnVsbCwicm9sZSI6bnVsbCwiY3JlYXRlZCI6MTY3ODQ3NTg0MjgxMiwidXNlcnR5cGUiOiJDVVNUT01FUiIsImV4cCI6MTY3ODQ3Njc0MiwidXNlcmlkIjo5NX0.8MbJ4I8CrhrCKPALFuoCajnBw-KXyZDO8K1NGTHaQdazJh1C2jbBUaXKkXAgjSpm1GNmCZ5J6wtLM3livq-3rg";
Request request = new Request.Builder()
.url("https://ecom-api.ottpay.com/api/v1/pay/weixin/active-pay")
.addHeader("Authorization", "Bearer " + token)
.post(body)
.build();
final OkHttpClient httpClient = new OkHttpClient();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
// Response
System.out.println(response.body().string());
} catch (IOException e) {
throw new RuntimeException(e);
}