code: int getResponseCodeFromBundle(@NotNull Bundle b) {
          Object o = b.get(RESPONSE_CODE);
          if (o == null) {
              Logger.d("Bundle with null response code, assuming OK (known issue)");
              return BILLING_RESPONSE_RESULT_OK;
          } else if (o instanceof Integer) return ((Integer) o).intValue();
          else if (o instanceof Long) return (int) ((Long) o).longValue();
          else {
              Logger.e("In-app billing error: ", "Unexpected type for bundle response code.");
              Logger.e("In-app billing error: ", o.getClass().getName());
              throw new RuntimeException("Unexpected type for bundle response code: " + o.getClass().getName());
          }
      }
docs: Workaround to bug where sometimes response codes come as Long instead of Integer