3
進出口試圖獲取有關通過我們的Android應用程序購買的訂閱信息,但保留通過此鏈接接入到Android播放API用於訂閱
https://www.googleapis.com/androidpublisher/v1/applications/[package]/subscriptions/[product id]/purchases/[subscription id]?access_token=[access token]
我有激活API控制檯中的API和創造得到這個responso Web應用程序客戶端ID
然後我允許,並從這個鏈接
複製給定的「代碼」 paramterehttps://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&approval_prompt=force&redirect_uri=http://localhost&client_id=[client id]
和獲取刷新令牌和訪問令牌(在這個存儲以便將來使用刷新令牌)通過PHP從我們的服務器
獲取刷新令牌 $ URL =「https://accounts.google.com/o/oauth2/token」;
$post_fields = array(
"grant_type" => "authorization_code",
"code" => urldecode($code),
"client_id" => $client_id,
"client_secret" => $client_secret,
"redirect_uri" => urldecode($redirect_uri));
獲得訪問令牌
$url = "https://accounts.google.com/o/oauth2/token";
$post_fields = $fields = array(
"grant_type" => "refresh_token",
"client_id" => $client_id,
"client_secret" => $client_secret,
"refresh_token" => $refresh_token);
$content = get_content($url, $post_fields);
兩種電話與做一個POST請求
function get_content($url, $post_fields) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
我的問題是,爲什麼我仍然得到來自谷歌
這種反應{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "developerDoesNotOwnApplication",
"message": "This developer account does not own the application."
}
],
"code": 401,
"message": "This developer account does not own the application."
}
}
你解決了嗎?我也有同樣的問題。 –
沒有 - 在這方面看起來並沒有太多 - 更新到商店API的第3版並做了很多其他的事情。 –