Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 8

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