Chrome WebStore Licensing API: extension developers are expected to have FULL access instead of FREE_TRIAL

217 Views Asked by At

I develop a paid extension and I want to add a free trial to it.
I follow https://developer.chrome.com/webstore/one_time_payments#verifying-payment.
To check that WebStore Licensing API works I make a request like this:

(async () => {

  const getTokenAsync = () => new Promise((resolve) => chrome.identity.getAuthToken(
    { interactive: true },
    resolve,
  ));

  fetch(
    `https://www.googleapis.com/chromewebstore/v1.1/userlicenses/${chrome.runtime.id}`,
    {
      headers: new Headers({
        Authorization: `Bearer ${await getTokenAsync()}`,
        'content-type': 'application/json',
      }),
    },
  )
    .then((res) => res.json())
    .then((json) => {

      console.log('Your license info:');
      console.log(json);
    });
})();

I run this script in an unpacked extension (with the same id as published one) under my google account which I use to develop the extension. This extension is published by a google group in which I am an owner.

The result I get is like the following:

{
  accessLevel: "FREE_TRIAL",
  createdTime: "<stamp from 2019 here>",
  itemId: "<extension id here>",
  kind: "chromewebstore#userLicense",
  maxAgeSecs: "2",
  result: true
}

Now I want to limit number of days a user may use the extension during his trial period.
However I don't want to apply this limit to my developer account.
The problem is that I can't distinguish my developers accounts from some different account of a user during a trial, because they are both FREE_TRIAL.

I think it's an issue in the API, I expect developer accounts to have FULL access level instead of FREE_TRIAL so I can apply my limit to the right group of users.

My question: how to distinguish a developer account from a user account during his free trial?

Also asked here: https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/SjyMVLea8u0/DuFw8aM7AwAJ.

0

There are 0 best solutions below