google play 支付验证projectNotLinked

链接多个项目问题

1. 问题: connect more than one project id to the google play developer console

google play v2版本支付验证问题 :
projectNotLinked如果有多个项目 怎么链接,因为后台只能链接一个?

When I try to execute a request for a Google developer API. purchases(). products(). get() I receive a 403 error: projectNotLinked.
The message tells me "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
At this point I can go to the console, unlink a previous project, and link this one, run the code, and the code works.
However, I cannot unlink permanently the previous project: I need to keep them both linked. How do I solve this problem?
I looked around and couldn't find a solution. Tried to call Google, and they told me that they do not support this kind of requests.
Thanks in advance.

2.

You can only have one project linked to your Play Developer console at a time. What you can do is try to move your credentials over to one project, so everything is contained in a single project. – Andy

3.

To reemphasise @andy's comment: There can be only one linked API project.
I spend quite some time to find this out. Google's documentation is not helpful here.
If you need access to by multiple projects/applications you can create multiple service accounts inside of the single linked API project and manages access to apps individually.

3.

Andy's comment is correct, I find the description LINKED PROJECT in the Google Play Developer Console confusing at best.
However, I setup in the Google Developers Console a company project with the appropriate Server Keys and Service accounts. It isn't ideal, but it works. You can then assign permission to the required service account back in the Google Play Developer Console.
You can also setup just one key and service account if that makes it simpler and the use them as shown below in PHP for a server

$service_account_name = 'xxxxxxxxxx-xxxxxxxxxxxxxxx@developer.gserviceaccount.com';
$key_file_location = somedir/keyfile.p12;

$client = new Google_Client();
$client->setApplicationName("GoogleDevelopersConsoleProjectName");
$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 = "GoogleDevelopersConsoleServerKey";
$client->setDeveloperKey($apiKey);

$package_name = "com.yourcompany.yourappname1";

Then all you need to do for the other application is change the $package_name.

$package_name = "com.yourcompany.yourappname2";

Then using the Google Service AndroidPublisher to query subscriptions

$service = new Google_Service_AndroidPublisher($client);

$results = $service->purchases_subscriptions->get($package_name,$subscriptionId,$token,array()

You can also start to assign multiple keys, service accounts and other credentials you add other projects in the Google Play Developer Console.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 11,055评论 0 23
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,653评论 5 6
  • 为什么自己用很长的时间才能干完?? 为什么自己一个人老是干不完事?? 一位英国科学家曾经做了这样一个实验他把一盘点...
    Amoss晴阅读 718评论 0 0
  • 饰品对每个女人来说都是买不够~我也如此,其中最亲睐的为项链,最简单的原因就是做事碍不着。我做姑娘时买它没理由,现在...
    两个方块阅读 484评论 0 0
  • 大腿的前外侧的一条筋痛,痛时痛到脚上中指上,躺着时放平时痛的没力气,请教刘老师如何是好? @乐山张丽胆经肝脾肾经络...
    496edc0304d2阅读 1,249评论 0 1

友情链接更多精彩内容