API Request - Subscription duration

Hey folks! I’m hoping that the Twitch devs monitor this board because I have a sneaky little suggestion.

We are gamedevs and partnered streamers and we offer in-game content to players that are subscribed to our channel. Currently we can check if a player is subscribed or not, but we’d like to see how long they’ve been subscribed for. Considering this data is already stored Twitch-side, I assume this implementation shouldn’t be too outrageously difficult?

This will allow us with the ability to provide differing tiers of rewards based on how long they’ve been subbed.

Would anyone else find value in this?

1 Like

You have a couple of options, albeit the first one may not be the best.

  1. Scan the Chat API for when they resubscribe. You can pull the length from there.
  2. In theory the user->created_at object has the date that the subscription occurred. You could calculate from that. (Getting date someone subscribed)

If a user unsubscribes and then resubscribes, the created_at value of a subscription resets. The initial date is only available through the subscriptions page on Twitch as an authenticated user and thus not available through normal means.

1 Like

Interestingly, I pulled for a subscription I have and it returns the original date I subscribed, 2014-12-30.

{“created_at”:“2014-12-30T22:16:42Z”,"_id":“f087f0e1a2c2e239d05b2be1141a5a1e82b7500a”,“sub_plan”:“1000”,“sub_plan_name”:“The Moojack Crew”,…

However, you are probably right, this is performing an authentication for myself to check my own data. Seems odd that this would be different than the record that is returned from the channel subscription call. Odd but we know the API is odd :slight_smile:

If you unsubscribe and then resubscribe it will change.

Good angles but I think there’s too much room for error here. It’d be nice if I didn’t have to find a hacky solution.

1 Like

I’ve also made a post about this but still no answer from Twitch (Re-Sub - Wrong timestamps).

I think this is something kind of important in the subscription data but in the meantime you only have bad solutions that can fix your problem but also give you wrong info.

That’s why I’ve been waiting before implementing anything with subscription duration.

I was asking around about it over a year and a half ago without luck then either.

No, that information is not available.

Personally, I handle this situation by verifying the created_at leaf and creating a window for re-subscriptions even after twitch’s system disconnects it.

Long story short, temp store and verify the leaf on the due date and for a week after (i do it every 24 hours anyway irrelevant of the timestamp). If they resub during twitches window it won’t change within that week, if it does then you can just “perma” store the original and link them in your application. Some may consider it “hacky” but it works fine and doesn’t require anything from a third party.

/shrug

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.