Google内购出现The project id used to call the Google Play Developer API has not been linked in the....

xiaoxiao2025-06-03  50

错误log:

{ "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." } }

换了google开发者账号后php后台报这个错误. 原因1:google开服者后台API需要关联 原因2:PHP后台有些参数需要配置

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_AssertionCredentials( $service_account_name, array('https://www.googleapis.com/auth/androidpublisher'), $key ); $client->setAssertionCredentials($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,array()); print_r ($results); //This object has all the data about the subscription echo "expiration: " . $results->expiryTimeMillis; exit;

原因3:配置完了后还需要重新添加内购项,这应该是google服务的机制,增加后看看是不是支付正常了.

转载请注明原文地址: https://www.6miu.com/read-5031175.html

最新回复(0)