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: 
gearheads
Channel Surfer

Single Channel Store Instance in a Task

I am using code from the Roku Billing Sample  to implement in-app purchasing. When I run the billing task in my app, I get a warning about:

BRIGHTSCRIPT: WARNING: clDoOrder: GetCatalog must be called on the same roChannelStoreObject before calling DoOrder

In the documentation for roChannelStore it mentions having only one instance of ChannelStore instantiated during the purchase flow. Looking at the RokuBillingTask from the sample code, a new channel store is created each time the task is run. So it creates a new ChannelStore instance when you call GetProducts and then it creates another ChannelStore instance when you call PurchaseProduct. This means multiple instances of the ChannelStore are created and we get the above error.

So how does Roku suggest using the ChannelStore and tasks in a way that works with the restriction of having only one instance of a ChannelStore?
0 Kudos
2 REPLIES 2
RokuKC
Roku Employee
Roku Employee

Re: Single Channel Store Instance in a Task

"gearheads" wrote:
...So how does Roku suggest using the ChannelStore and tasks in a way that works with the restriction of having only one instance of a ChannelStore?


Possibly https://blog.roku.com/developer/channel ... ling-guide will help?

I believe for an RSG app you want to use the ChannelStore node (https://sdkdocs.roku.com/display/sdkdoc/ChannelStore), not roChannelStore.
0 Kudos
gearheads
Channel Surfer

Re: Single Channel Store Instance in a Task

Using the ChannelStore node works now. I was following the sample code on https://sdkdocs.roku.com/display/sdkdoc ... Purchasing which still uses the roChannelStore object and a Task. That page should probably be updated to use the more recent sample code.
0 Kudos