2

I am using Google.Apis.AndroidPublisher.v2 to get Inappproducts: list and inapp purchases details. I have created a new service account in my app console and using .p12 key as required. Here is my code:

String serviceAccountEmail = "iap-119@abc.iam.gserviceaccount.com";
        var fullPath = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/key.p12");
        var certificate = new X509Certificate2(fullPath, "notasecret", X509KeyStorageFlags.Exportable);

        ServiceAccountCredential credential = new ServiceAccountCredential(
           new ServiceAccountCredential.Initializer(serviceAccountEmail)
           {
               Scopes = new[] { "https://www.googleapis.com/auth/androidpublisher" }
           }.FromCertificate(certificate));


        var service = new AndroidPublisherService(
           new BaseClientService.Initializer()
           {

               ApplicationName = "abc",
               HttpClientInitializer = credential
           });
        var request = service.Inappproducts.List("com.Its.abc");
        var purchaseState = request.Execute();

I got following error on request.Execute(); Message[No application was found for the given package name.] Location[packageName - parameter] Reason[applicationNotFound] Domain[global]

However my package name is correct and same package name is uploaded on play store.

Thanks,

  • _“No application was found for the given package name.”_ together with a 404 may also occur (as a `Google.Apis.Requests.RequestError`) when an app has been suspended (i.e. removed) from Google Play. – dakab Apr 04 '19 at 13:23

1 Answers1

2

I have found the solution. Need to add service account as a linked account on "API Access" page on Google Play Console. Also add service account email as a user in developer console with required permissions.