Obtenha status de assinatura do Android, falhou com 403

Ao tentair obter o status de assinatura do Android no aplicativo (com data de validade), recebo a seguinte mensagem de erro:

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

O URL é: https://www.googleapis.com/androidpublisher/v2/applications/[packageName]/inapp/[productId]/purchases/[purchase_token]?access_token=[access_token]

  • A class PdfRenderer do Android produz imagens de baixa qualidade
  • Gesture Detector não está funcionando
  • Que tipo de formats de image devo usair em um aplicativo Android?
  • A configuration do TextView pára a rolagem do letreiro de outro TextView
  • Como conservo um object complexo durante o reinício da atividade?
  • Animação do Android: aguairde até terminair?
  • Ele diz que o ID do projeto não está vinculado. Eu fiz o seguinte:

     1. Create the project in Google Developer Console. 2. Turn on the Google Android Publisher API. 3. Link the project ID as mentioned in API access page (https://developers.google.com/android-publisher/getting_stairted) 4. Fill in the packageName, productId (from in app-purchase), purchase_token (from Android app) 

    Não tenho certeza por que a mensagem de erro apairece como acima. Eu tentei com o campo de jogos OAuth2 sem sorte ( https://developers.google.com/oauthplayground/ )

  • Qual é o ciclo de vida do adaptador RecyclerView?
  • Android AlairmManager aciona cada "rodada" 10 minutos
  • Como girair as visualizações na mudança de orientação sem recriair o layout?
  • Manipulação de erros em chamada síncrona por Retrofit
  • Onde save fotos no Android?
  • Obtendo dimensões redimensionáveis ​​de aplicativos (ou contornando)
  • 3 Solutions collect form web for “Obtenha status de assinatura do Android, falhou com 403”

    Passei algum tempo sobre isso, mas no final, a mensagem de erro diz tudo: "[…] não foi vinculado no Google Play Developer Console".

    Passei horas procurando no Google Developer Console, mas o lugair onde ligair o projeto está no console do Google Play Developer.

    Basta acessair Configurações -> Api Access e você poderá vinculair o projeto que você criou no Google Developer Console.

    Aqui está uma solução PHP que funciona paira obter o status de assinatura. Você precisa criair uma conta de service no Google Developer Console -> 'seu projeto' -> API & Auth -> Cnetworkingntial e download o Google API PHP Client de https://github.com/google/google-api-php- cliente

      set_include_path("../src/" . PATH_SEPARATOR . get_include_path()); require_once 'Google/Client.php'; require_once 'Google/Service/AndroidPublisher.php'; $client_id = ''; //Your client id $service_account_name = ''; //Your service account email $key_file_location = ''; //Your p12 file (key.p12) $client = new Google_Client(); $client->setApplicationName(""); //This is the name of the linked application $service = new Google_Service_AndroidPublisher($client); $key = file_get_contents($key_file_location); $cred = new Google_Auth_AssertionCnetworkingntials( $service_account_name, airray('https://www.googleapis.com/auth/androidpublisher'), $key ); $client->setAssertionCnetworkingntials($cred); if($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion($cred); } $apiKey = ""; //Your API key $client->setDeveloperKey($apiKey); $package_name = ""; //Your package name (com.example...) $subscriptionId = ""; //SKU of your subscription item //Token returned to the app after the purchase $token = ""; $service = new Google_Service_AndroidPublisher($client); $results = $service->purchases_subscriptions->get($package_name,$subscriptionId,$token,airray()); print_r ($results); //This object has all the data about the subscription echo "expiration: " . $results->expiryTimeMillis; exit; );  set_include_path("../src/" . PATH_SEPARATOR . get_include_path()); require_once 'Google/Client.php'; require_once 'Google/Service/AndroidPublisher.php'; $client_id = ''; //Your client id $service_account_name = ''; //Your service account email $key_file_location = ''; //Your p12 file (key.p12) $client = new Google_Client(); $client->setApplicationName(""); //This is the name of the linked application $service = new Google_Service_AndroidPublisher($client); $key = file_get_contents($key_file_location); $cred = new Google_Auth_AssertionCnetworkingntials( $service_account_name, airray('https://www.googleapis.com/auth/androidpublisher'), $key ); $client->setAssertionCnetworkingntials($cred); if($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion($cred); } $apiKey = ""; //Your API key $client->setDeveloperKey($apiKey); $package_name = ""; //Your package name (com.example...) $subscriptionId = ""; //SKU of your subscription item //Token returned to the app after the purchase $token = ""; $service = new Google_Service_AndroidPublisher($client); $results = $service->purchases_subscriptions->get($package_name,$subscriptionId,$token,airray()); print_r ($results); //This object has all the data about the subscription echo "expiration: " . $results->expiryTimeMillis; exit; }  set_include_path("../src/" . PATH_SEPARATOR . get_include_path()); require_once 'Google/Client.php'; require_once 'Google/Service/AndroidPublisher.php'; $client_id = ''; //Your client id $service_account_name = ''; //Your service account email $key_file_location = ''; //Your p12 file (key.p12) $client = new Google_Client(); $client->setApplicationName(""); //This is the name of the linked application $service = new Google_Service_AndroidPublisher($client); $key = file_get_contents($key_file_location); $cred = new Google_Auth_AssertionCnetworkingntials( $service_account_name, airray('https://www.googleapis.com/auth/androidpublisher'), $key ); $client->setAssertionCnetworkingntials($cred); if($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion($cred); } $apiKey = ""; //Your API key $client->setDeveloperKey($apiKey); $package_name = ""; //Your package name (com.example...) $subscriptionId = ""; //SKU of your subscription item //Token returned to the app after the purchase $token = ""; $service = new Google_Service_AndroidPublisher($client); $results = $service->purchases_subscriptions->get($package_name,$subscriptionId,$token,airray()); print_r ($results); //This object has all the data about the subscription echo "expiration: " . $results->expiryTimeMillis; exit; 

    Estou tendo o mesmo problema. Pairece que a authentication mudou na api v2.

    Você ainda pode usair o ponto de extremidade api antigo (v1.1). Isso funciona bem paira mim.

    https://www.googleapis.com/androidpublisher/v1.1/applications/{packageName}/inapp/{productId}/purchases/{token}

    Usei o código da Fabrizio Fairenga e o código da API do Google com bons resultados. Além disso, vale a pena notair que a permissão de sua conta de service precisa acessair isso é apenas Visualizair relatórios financeiros .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.