ChannelStore

ChannelStore provides an interface to the Roku Streaming Store for in-app purchases, user authentication, subscription management, and credential storage

import { ChannelStore } from "@roku-sdk/components";
ChannelStore(props: IChannelStoreProps): JSX.Element

Description

ChannelStore provides an interface to the Roku Streaming Store for in-app purchases, user authentication, subscription management, and credential storage.

Usage follows a command pattern: set required data fields, observe the result event, then set command to trigger execution. Results arrive asynchronously via event handlers.

Parameters

NameTypeDescription
propsIChannelStoreProps

Example

// Retrieve user data for sign-in
<ChannelStore
    requestedUserData="email,firstname,lastname"
    command="getUserData"
    onUserDataObject={(data) => console.log("User data:", data)}
/>
// Perform an in-app purchase
<ChannelStore
    orderObject={[{ code: "item1", qty: 1 }]}
    command="doOrder"
    onOrderStatusObject={(status) => console.log("Order status:", status)}
/>

Types

IChannelStoreProps

Properties for the ChannelStore component.

The ChannelStore component provides an interface to the Roku Streaming Store, enabling in-app purchases, user authentication, and data retrieval. It supports commands for fetching user data, managing orders, retrieving catalogs, and handling credentials. This component wraps the <channelStoreExt> XML element and exposes its fields as TypeScript props and event handlers.

NameTypeDescription
channelCredData?stringData to be stored securely for channel credentials via the storeChannelCredData command.
command?ChannelStoreCommandSpecifies the command to be executed (e.g., "getUserData", "getCatalog").
confirmPartnerOrderObject?IPartnerOrderConfirms the product being ordered from a TVOD app.
deltaOrder?IOrderItemEnables incremental population of the order field. Each time this is set, the order is modified (use negative qty to remove items).
id?string
onCatalogObject?EventHandlerCatalogFired when the catalog is retrieved from the getCatalog command.
onChannelCredObject?EventHandlerChannelCredFired when channel credentials are retrieved via the getChannelCred command.
onConfirmPartnerOrderStatusObject?EventHandlerPartnerOrderFired when confirming a partner order completes.
onDeviceAttestationTokenObject?EventHandlerDeviceAttestationTokenFired when a device attestation token is generated via getDeviceAttestationToken.
onOrderItemsStatusObject?EventHandlerOrderItemsStatusFired when order items are processed (child nodes of orderStatus).
onOrderStatusObject?EventHandlerOrderStatusFired when the doOrder command completes with completion status.
onPurchasesObject?EventHandlerPurchasesFired when purchase data is available from getPurchases or getAllPurchases commands.
onPurchasesStatusObject?EventHandlerPurchasesStatusFired when purchases are retrieved from getPurchases or getAllPurchases commands (completion status). See below.
onRequestPartnerOrderStatusObject?EventHandlerPartnerOrderFired when requesting a partner order completes.
onRequestStatus?EventHandler<IChannelStoreRequestStatusEvent>Fired when a custom request completes.
onStoreChannelCredDataStatusObject?EventHandlerStoreChannelCredDataStatusFired when storing channel credential data completes.
onUserDataObject?EventHandlerUserDataFired when user data is retrieved from the getUserData command. Returns invalid if the user clicked Cancel on the RFI screen.
onUserRegionDataObject?EventHandlerUserRegionDataFired when user region data is retrieved from the getUserRegionData command.
orderObject?IOrderItem[]Contains the order to be filled when the doOrder command is executed.
request?IChannelStoreRequestCustom request object for advanced ChannelStore operations.
requestedUserData?stringSpecifies the Roku customer account fields to be retrieved when the getUserData command is executed. Set to "all" for all available fields, or a comma-separated list of specific fields (e.g., "email,firstname,lastname").
requestedUserDataInfoObject?IRequestedUserDataInfoConfigures whether the RFI screen is used for sign-ups or sign-ins.
requestPartnerOrderObject?IPartnerOrderSpecifies the product to be ordered from a TVOD app.

IChannelStoreProps.onPurchasesStatusObject

Fired when purchases are retrieved from getPurchases or getAllPurchases commands (completion status).

Receives the command's status, not the purchase data: the backing field purchasesStatusObject is an assocarray holding the request node's own fields, and is {} when the request failed. The purchases themselves arrive on IChannelStoreProps.onPurchasesObject.

ChannelStoreCommand

Command strings supported by the ChannelStore node.

type ChannelStoreCommand = "none" | "getUserData" | "getUserRegionData" | "storeChannelCredData" | "getChannelCred" | "getCatalog" | "doOrder" | "getPurchases" | "getAllPurchases" | "requestPartnerOrder" | "confirmPartnerOrder" | "getDeviceAttestationToken";

IPartnerOrder

Partner order data for TVOD apps (requestPartnerOrder / confirmPartnerOrder).

NameTypeDescription
codestringProduct identifier.
contentKeystringPublisher-specific SKU or unique identifier.
couponCode?stringAlphanumeric coupon code for discounted pricing.
orderID?stringOrder ID returned by Roku (for confirmPartnerOrder).
pin?string
pricestringFinal price including discounts (no currency symbol).
priceDisplaystringOriginal price of the product (no currency symbol, e.g., "3.99").
title?stringProduct description (e.g., movie title).

IOrderItem

An item in an order for the doOrder command.

NameTypeDescription
action?stringSet to "Upgrade" or "Downgrade" for subscription plan changes.
codestringProduct identifier.
qtynumberQuantity to purchase.

EventHandlerCatalog

type EventHandlerCatalog = EventHandler<IProduct[]>;

EventHandlerChannelCred

type EventHandlerChannelCred = EventHandler<IChannelCred>;

EventHandlerPartnerOrder

type EventHandlerPartnerOrder = EventHandler<IPartnerOrder>;

EventHandlerDeviceAttestationToken

type EventHandlerDeviceAttestationToken = EventHandler<IDeviceAttestationToken>;

EventHandlerOrderItemsStatus

type EventHandlerOrderItemsStatus = EventHandler<IPurchase[]>;

EventHandlerOrderStatus

type EventHandlerOrderStatus = EventHandler<IOrderStatus>;

EventHandlerPurchases

type EventHandlerPurchases = EventHandler<IPurchase[]>;

EventHandlerPurchasesStatus

type EventHandlerPurchasesStatus = EventHandler<IPurchasesStatus>;

IChannelStoreRequestStatusEvent

NameTypeDescription
commandstring
contextRecord<string, string>
requestidnumber
resultRecord<string, string | number | boolean>
statusnumber
statusmessagestring

EventHandlerStoreChannelCredDataStatus

type EventHandlerStoreChannelCredDataStatus = EventHandler<IStoreChannelCredDataStatus>;

EventHandlerUserData

type EventHandlerUserData = EventHandler<IUserData>;

EventHandlerUserRegionData

type EventHandlerUserRegionData = EventHandler<IUserRegionData>;

IChannelStoreRequest

Custom request object for advanced ChannelStore operations.

NameTypeDescription
command?string
context?ResObject<Record<string, string>>
params?ResObject<Record<string, string | number | boolean>>

IRequestedUserDataInfo

Configuration for the RFI (Request for Information) screen.

NameTypeDescription
context?ChannelStoreUserDataContextWhether the RFI screen is for sign-up or sign-in.
forceShowData?booleanWhen true, the RFI signup screen displays the values of the requested customer information. Has no effect if context is "signin".

IProduct

Product information returned by the getCatalog command.

NameTypeDescription
codestringProduct identifier from the Developer Dashboard.
coststringLocalized cost with currency symbol.
freeTrialQuantitynumberFree trial length (e.g., 1 for 1-month, 7 for 7-day).
freeTrialTypestringFree trial unit ("Days" or "Months").
namestringItem name / description.
productTypestringProduct type (e.g., "MonthlySub").
purchaseDatestringSubscription purchase date.
qtynumberQuantity (for consumable products).
statusstringWhether the product is "saved" or "approved for sale".
trialCostnumberIntroductory pricing discounted price.
trialQuantitynumberMonths of introductory pricing.
trialTypestringUnit for introductory pricing ("months").

IChannelCred

Channel credential data returned by the getChannelCred command.

NameTypeDescription
channelIdstringThe app ID (e.g., "2213" for Roku Media Player).
errorCodestringError description; empty string on success.
jsonstringJSON string containing roku_pucid, token_type, channel_data, and error fields.
publisherDeviceIdstringUnique identifier of the device.
statusnumberRequest status; 0 indicates success.

IDeviceAttestationToken

Device attestation token returned by the getDeviceAttestationToken command.

NameTypeDescription
noncestringThe nonce used to generate the token.
statusnumberRequest status; 0 indicates success.
tokenstringSigned JWT for device attestation verification.

IPurchase

Purchase information returned by getPurchases or getAllPurchases commands.

NameTypeDescription
codestringProduct identifier.
coststringLocalized cost with currency symbol.
expirationDatestringSubscription expiration date (ISO 8601).
freeTrialQuantitynumberFree trial length.
freeTrialTypestringFree trial unit ("Days" or "Months").
inDunningstringWhether subscription is past due ("true" if in dunning state).
namestringItem name / description.
productTypestringProduct type (e.g., "MonthlySub").
purchaseChannelstringWhere the purchase was made ("web" or "device").
purchaseContextstringHow the purchase was made ("isu" or "iap").
purchaseDatestringPurchase date (ISO 8601).
purchaseIdstringTransaction ID.
qtynumberQuantity purchased.
renewalDatestringSubscription renewal date (ISO 8601).
statusstring"Valid" for current subscriptions, "Invalid" for canceled/expired.
statusMessagestringDescription of the status.
trialCostnumberIntroductory pricing discounted price.
trialQuantitynumberMonths of introductory pricing.
trialTypestringUnit for introductory pricing ("months").

IOrderStatus

Status returned by the doOrder command.

NameTypeDescription
statusnumberCompletion status (1 = success, 2 = interrupted, 0 = network error, etc.).
statusMessagestringDescription of the completion status.

IPurchasesStatus

Status returned by getPurchases / getAllPurchases commands.

NameTypeDescription
statusnumber
statusMessagestring

IStoreChannelCredDataStatus

Status returned by the storeChannelCredData command.

NameTypeDescription
responsestringJSON string with status, error, and error_detail fields.
statusnumberRequest status; 0 indicates success.

IUserData

Roku customer account information returned by the getUserData command.

NameTypeDescription
birth?string
city?string
country?string
email?string
firstName?string
gender?string
lastName?string
phone?string
state?string
street?string
zip?string

IUserRegionData

Region data returned by the getUserRegionData command.

NameTypeDescription
countrystring
statestring
zipstring

ChannelStoreUserDataContext

Context for the RFI (Request for Information) screen.

type ChannelStoreUserDataContext = "signin" | "signup";

What’s Next

Did this page help you?