How to implement an In-App purchase in Roku Channels?

How to implement an In-App purchase in Roku Channels?

31 July 2020

These days most of the Roku channels provide In-app Purchases for their users. In-app Purchases are basically the products that are shown to the users when the channel is running and they can buy/subscribe to the products accordingly.

This article will help you to navigate through the 8 simple steps required for the implementation of in-app purchases.

Steps for storing, fetching, and ordering a purchase are given below

Storing

Step 1: Create a roChannelStore object and a roMessagePort object for fetching and store channel data locally.

In_App_purchase_in_Roku_Channels_01

Step 2: Create roAssociativeArray for storing channel products and already purchased products.

Step 3: Call setMessagePort function for the roChannelStore object.

Fetching

Step 4: Use GetPurchases() associated with roChannelStore object for fetching users purchased products. Use while loop along with the message port for getting “roChannelStoreEvent” and message response as roList of roAssociativeArray.

Step 5: Use GetCatalog() with the associated roChannelStore object for fetching products associated with the current channel. Use while loop along with the message port for getting “roChannelStoreEvent ” and message response as roList of roAssociativeArray.

Step 6: Use GetuserData() before making purchases for a valid user account and information checking.

Ordering

Step 7: Use SetOrder(Order as roList of roAssocativeArray) and DoOrder() with the associated roChannelStore variable for setting order into the cart and on confirm go to the payment method respectively. (Note: It’s a good practise to call clearOrder() before adding to cart)

In_App_purchase_in_Roku_Channels_02

Step 8: Use RequestPartnerOrder(orderInfo as roAssociativeArray,ProductID as string) and ConfirmPartnerOrder(confirmOrderInfo as roAssociativeArray,ProductID as string) for checking and confirming of user billing and transaction process.(Note: orderInfo will Contain priceDisplay and price keys with string values for the price displayed and the price charged, respectively. The currency symbol may not be included in the price or priceDisplay values.)

The coding part for in-app purchases implementation is now completed, you can now publish this build after this go to the developer dashboard in roku.developer.com.

Select: Manage My In-Channel Products -> “Add a New Product” set the channel you want that product to be added and fill up all the required fields.

For testing the in-app purchases as a test user and billing testing of $0.00 transaction: Add a test user in Manage Test users, and designate a channel in “Manage my channels” as a billing testing.

For more references, you can also visit here.

https://developer.roku.com/en-ot/docs/references/brightscript/interfaces/ifchannelstore.md

https://developer.roku.com/en-ot/docs/developer-program/roku-pay/roku-pay-and-in-channel-purchasing.md

search
Blog Categories
Request a quote