Posts /

안드로이드 영수증처리 API 에러 처리

20 Apr 2018

Error

{
  "code" : 403,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
    "reason" : "projectNotLinked"
  } ],
  "message" : "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
}

Handling

Error

{
  "error" : "invalid_grant",
  "error_description" : "Invalid JWT Signature."
}
JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
GoogleCredential credential = new GoogleCredential.Builder()
  .setTransport(httpTransport)
  .setJsonFactory(JSON_FACTORY)
  .setServiceAccountId("...~~@~~.iam.gserviceaccount.com")  // 이곳에 들어가는 서비스계정 ID
  .setServiceAccountPrivateKeyFromP12File(new File("....~.p12"))
  .setServiceAccountScopes(Collections.singleton("https://www.googleapis.com/auth/androidpublisher"))
  .build();

Handling


Twitter Facebook Google+