0

I'm getting this error Expected BEGIN_OBJECT but was STRING at line 1 column 1 path when I run my app. Besides that, it crashes. I'm new at coding so, what I'm doing wrong? Thank you!

This is the part of the code where the Logcat says is the error.

private void onPaymentSuccess(@NonNull final Response response) throws IOException {
    Gson gson = new Gson();
    Type type = new TypeToken<Map<String, String>>(){}.getType();
    Map<String, String> responseMap = gson.fromJson(
            Objects.requireNonNull(response.body()).string(),
            type
    );
    paymentIntentClientSecret = responseMap.get("clientSecret");
}
Federico klez Culloca
  • 22,898
  • 15
  • 55
  • 90

0 Answers0