如何从SKU订阅中检索用户电子邮件

时间:2019-10-12 14:57:58

标签: php android in-app-purchase in-app-billing in-app-subscription

我有一个cron作业,该作业会定期调用PHP脚本,然后依次检查我的Android应用程序的所有用户活动订阅。如果订阅已过期,则脚本会将用户标记为已过期。

我正在使用Google API客户端2.2.0

$package = "xxxxxxxxxxxxx";
$sku = "xxxxxx";

$client = new Google_Client();
$client->setScopes(array("https://www.googleapis.com/auth/androidpublisher"));
$client->setAuthConfig('xxxxxxxxxxx.json');
$service = new Google_Service_AndroidPublisher($client);

我只需执行以下操作即可检查订阅:

    $res = $service->purchases_subscriptions->get($package, $sku, $token);
    $state = $res["paymentState"];

从数据库中检索$ token的位置(在用户首次购买订阅时存储)。

一切正常,但是我想知道如何获取用户的Gmail地址。有办法吗?

0 个答案:

没有答案