question

Randy Thompson avatar image
Randy Thompson asked

Checking ISP Subscription Status while "out of session"

Is there any way to check a user's ISP subscription status (ENTITLED or not) when the user isn't currently using the skill? When I attempt to do this via the Skill Messaging API, I get this...

{"type": "FORBIDDEN", "message": "alexa::skill:products:entitlements permission not granted."} 


Also, is it possible to subscribe to "ISP_SUBSCRIBE" and "ISP_UNSUBSCRIBE" events as you can with SKILL_ENABLE and SKILL_DISABLE?

Both of these would be very useful since users are allowed to subscribe and unsubscribe outside of the skill ("out of session") via the Alexa app, thus making any subscription status stored in my skill's database obsolete.


I would like very much to offer some "offline" features to ISP subscribers but cannot practically do so if I have no out-of-session way to check their status.

Thanks, -Randy

isp
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Randy Thompson avatar image
Randy Thompson answered

The answer is that you cannot check ISP status while out of session.

Perhaps Amazon will add this capability in the future.

-Randy


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anand@Amazon avatar image
Anand@Amazon answered

Hi @Randiculous,

Thanks for reaching out to us !!

We have ISP API which you can use to get all ISP products which you can filter later on by checking "purchasable" field.

Below is the API endpoint details:

GET /v1/users/~current/skills/~current/inSkillProducts
Host: {event.context.System.apiEndpoint}
Accept-Language: {event.request.locale}
Authorization: Bearer {event.context.System.apiAccessToken}

Response will be like below :

{
  "inSkillProducts": [
    {
      "productId": "amzn1.adg.product.unique-id-1",
      "referenceName": "your_product_name_1",
      "type": "ENTITLEMENT",
      "name": "Friendly Name",
      "summary": "Description of the product.",
      "entitled": "NOT_ENTITLED",
      "purchasable": "PURCHASABLE",
      "activeEntitlementCount": 0,
      "purchaseMode": "TEST"
    },
    {
      "productId": "amzn1.adg.product.unique-id-2",
      "referenceName": "your_product_name_2",
      "type": "SUBSCRIPTION",
      "name": "Friendly Name",
      "summary": "Description of the product.",
      "entitled": "ENTITLED",
      "purchasable": "NOT_PURCHASABLE",
      "activeEntitlementCount": 1,
      "purchaseMode": "TEST"
    },
    {
      "productId": "amzn1.adg.product.unique-id-3",
      "referenceName": "your_product_name_3",
      "type": "CONSUMABLE",
      "name": "Friendly Name",
      "summary": "Description of the product.",
      "entitled": "ENTITLED",
      "purchasable": "PURCHASABLE",
      "activeEntitlementCount": 2,
      "purchaseMode": "TEST"
    }
  ],
  "nextToken": null,
  "truncated": false
}

Check this link for more details.

6 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks for the reply, @Anand@Amazon. Unfortunately, your answer does not appear to address the question I asked.

I am using the API you reference to get ISP info while "in session." That works fine, of course. However, I want to track ISP info while the skill is not in use (while "out of session").

Note that because users are allowed to subscribe and unsubscribe outside of the skill ("out of session") via the Alexa app, I can't simply filter the data "later on" and expect it to be valid. I have to hope they launch the skill again to see if they are still a subscriber.

Can you please re-read my question and, if you still don't understand it, ask me to clarify?

Thanks so much,

-Randy

0 Likes 0 ·

Hi @Randiculous

ISP status can be queried anytime as long as you have valid access token. You can use Postman to query this API.

For your second question about subscription to events this is not available as good practices dictate that you should be querying the status every time user access your skill.

Everytime the user starts a session or reaches a point in the skill experience that they should only have access if they’ve purchased it before, the developer should check their eligibility to access it.

You should check and update the inventory on every incoming request. The ASK SDKs for Node.js, Java, and Python all include request interceptors, which are a useful way to execute code before your normal request handler. This can be a good way to implement this inventory check.

Check here for more details.

0 Likes 0 ·

Hello @Anand@Amazon

This part of your answer sounds promising: "ISP status can be queried anytime as long as you have valid access token."

I believe you are implying that I can use access tokens at any time when out of session (which would solve my problem). Based on my tests, however, access tokens change between sessions.

Are you saying the ISP access tokens do not expire?


Thanks so much,

-Randy

0 Likes 0 ·
Show more comments