Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
basitnizami
Visitor

In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

Good Day Everyone!

I have gone through all of the documentation stuff and have read about the "roChannelStore" component that can be used for in-channel purchases or subscriptions. I have also read about the "Fake Server" approach for local development (side-loading) and how it uses the xml files as the server calls instead of actually talking to roku server when we do  "store.FakeServer(true)" where "store" is an instance of "roChannelStore".

My Scenario
I have an application that shows a video thumbnail and when I click on it, it shows a button to "Play" using Label List. Clicking that button plays the video at the moment.

My Requirement
I want to check if the current user is subscribed to the video shown and only then show the "Play" button. I can do this by fetching the subscribed products using  "GetPurchases()" function and then checking if the product is inside that collection. Otherwise show two buttons. One for monthly subscription price and the other for annual subscription price that I can use to trigger the Order Placement.

The Problem
The way I see it, a product can be set as either Consumable, NonConsumable or MonthlySub in that xml file. Is that possible for a single product that I can choose if I want either monthly subscription or annual? How to handle this scenario? I cannot figure out how to allow both monthly and annual subscription types link to one product and then trigger that specific subscription from my code.
The xml file I'm talking about is the "GetCatalog.xml" file, provided in the "csfake" folder in the sample project that I downloaded from https://blog.roku.com/developer/2013/06/06/supporting-in-app-purchases-in-your-roku-brightscript-cha... (download link in the end)

Any help or pointer would be really appreciated.
0 Kudos
7 REPLIES 7
EnTerr
Roku Guru

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

See also viewtopic.php?f=34&t=95592 for errata.

Seems to me you will have to create 2 separate Roku "in-channel products" for each of your inventory items - one for monthly and one for annual - and then make sure to check for and distinguish each. On a side note, i have never used the fake server - instead just create the products online and test them with a test user (does not incur actual charges).
0 Kudos
basitnizami
Visitor

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

Thanks for your reply EnTerr.

Yes, I'm also thinking about going that direction but I have a confusion. If I create two products with different subscription types, can I have the same "code" on both of the products? So only the subscription type would be different and code would be same. Is that possible?
0 Kudos
EnTerr
Roku Guru

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

"basitnizami" wrote:
Yes, I'm also thinking about going that direction but I have a confusion. If I create two products with different subscription types, can I have the same "code" on both of the products? So only the subscription type would be different and code would be same. Is that possible?

Not the way i described it - no. The way i understand it, a "product" in Roku parlance is uniquely identified by its code - i.e. the code is like a primary key in relational DB. You cannot have 2 rows in the same table with the same primary key. 

That does no mean you cannot come with a clever naming for your codes though :). Like using a term prefix or suffix. Say your video clip inventory# is "1234", then the two products be named "1234a" for annual and "1234m" for monthly.  Or "a1234" and "m1234" respectively
0 Kudos
basitnizami
Visitor

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

Alright thanks for clarification.

So I would have to create some kind of approach then to uniquely tag the products with an identifier and then link them with the actual "one video" that needs to be played. I'm thinking about something like the following.

For example, the identifier I choose is "abc", now for monthly item, I can tag this item as "abc_m" and for yearly "abc_y". The original item, the video that has this subscription attached to, will have something attached to it which would be "abc". So, I can add _m or _y and then check in the collection returned by GetPurchases() function if it has any one of those variations. I think it makes sense now, isn't it?
0 Kudos
basitnizami
Visitor

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

Lol. I think either you edited your previous post or I didn't notice the last clever part. I was thinking exactly the same 😄
0 Kudos
EnTerr
Roku Guru

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

"basitnizami" wrote:
Lol. I think either you edited your previous post or I didn't notice the last clever part. I was thinking exactly the same 😄

That was me, sorry. Suppose we were typing in parallel. My cleverness comes in iterations  😛

Exactly what you said! Come with a business rule about it and then you can trivially convert between your IDs and Roku product ones by concatenating or chopping the last (or first) letter.
0 Kudos
basitnizami
Visitor

Re: In-Channel Monthly / Annual Subscription issue in Roku / Bright Script

Haha. Yeah it happens some times. As you are exploring different options, you start getting ideas. No problem at all.

yeah sure, I will. Thank you so much EnTerr for your help on this. Really appreciated. (y)
0 Kudos