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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to stop roChannelStoreEvent when the screen is closed


I have used sample application for in app purchases in ROKU channels from the link Three screens used
1. main screen, which displays the option for the user to choose to go to purchase page.
2. purchase screen, it takes some time to display the products but purchase flow works without any errors
3. success screen, displays this paragraph screen once the payment is valid

While the user is in purchase screen and before the products load, if the user hits the back button, the user is taken back to Main screen but after few seconds redirects to success page. The user did not even started the purchase but they are taken to the success page.

The issue here is once the back button is clicked before the products are loaded, screen is closed for roListScreenEvent but roChannelStoreEvent still continues to go forward with its task which results in redirecting the screen to purchase page.

if (type(msg) = "roListScreenEvent")
if (msg.isListItemSelected())
index = msg.GetIndex()
else if msg.isScreenClosed() then ' takes the user back to main screen
else if (type(msg) = "roChannelStoreEvent")
if msg.IsRequestSucceeded() then
print msg.GetResponse()
ShowParagraphScreen() 'displays the success screen
else if msg.IsRequestFailed() then
print msg.isRequestFailed(); "------------"
else if msg.isRequestInterrupted() then
print "interrupted"
end if
end if

Is there any option to stop roChannelStoreEvent along side roListScreenEvent once the screen is closed or back button is pressed?
Or am I doing something wrong here?
Let me know if you need the whole code sample to test.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.