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.ElementDescription
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
| Name | Type | Description |
|---|---|---|
props | IChannelStoreProps |
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.
| Name | Type | Description |
|---|---|---|
channelCredData? | string | Data to be stored securely for channel credentials via the storeChannelCredData command. |
command? | ChannelStoreCommand | Specifies the command to be executed (e.g., "getUserData", "getCatalog"). |
confirmPartnerOrderObject? | IPartnerOrder | Confirms the product being ordered from a TVOD app. |
deltaOrder? | IOrderItem | Enables incremental population of the order field. Each time this is set, the order is modified (use negative qty to remove items). |
id? | string | |
onCatalogObject? | EventHandlerCatalog | Fired when the catalog is retrieved from the getCatalog command. |
onChannelCredObject? | EventHandlerChannelCred | Fired when channel credentials are retrieved via the getChannelCred command. |
onConfirmPartnerOrderStatusObject? | EventHandlerPartnerOrder | Fired when confirming a partner order completes. |
onDeviceAttestationTokenObject? | EventHandlerDeviceAttestationToken | Fired when a device attestation token is generated via getDeviceAttestationToken. |
onOrderItemsStatusObject? | EventHandlerOrderItemsStatus | Fired when order items are processed (child nodes of orderStatus). |
onOrderStatusObject? | EventHandlerOrderStatus | Fired when the doOrder command completes with completion status. |
onPurchasesObject? | EventHandlerPurchases | Fired when purchase data is available from getPurchases or getAllPurchases commands. |
onPurchasesStatusObject? | EventHandlerPurchasesStatus | Fired when purchases are retrieved from getPurchases or getAllPurchases commands (completion status). See below. |
onRequestPartnerOrderStatusObject? | EventHandlerPartnerOrder | Fired when requesting a partner order completes. |
onRequestStatus? | EventHandler<IChannelStoreRequestStatusEvent> | Fired when a custom request completes. |
onStoreChannelCredDataStatusObject? | EventHandlerStoreChannelCredDataStatus | Fired when storing channel credential data completes. |
onUserDataObject? | EventHandlerUserData | Fired when user data is retrieved from the getUserData command. Returns invalid if the user clicked Cancel on the RFI screen. |
onUserRegionDataObject? | EventHandlerUserRegionData | Fired 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? | IChannelStoreRequest | Custom request object for advanced ChannelStore operations. |
requestedUserData? | string | Specifies 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? | IRequestedUserDataInfo | Configures whether the RFI screen is used for sign-ups or sign-ins. |
requestPartnerOrderObject? | IPartnerOrder | Specifies 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).
| Name | Type | Description |
|---|---|---|
code | string | Product identifier. |
contentKey | string | Publisher-specific SKU or unique identifier. |
couponCode? | string | Alphanumeric coupon code for discounted pricing. |
orderID? | string | Order ID returned by Roku (for confirmPartnerOrder). |
pin? | string | |
price | string | Final price including discounts (no currency symbol). |
priceDisplay | string | Original price of the product (no currency symbol, e.g., "3.99"). |
title? | string | Product description (e.g., movie title). |
IOrderItem
An item in an order for the doOrder command.
| Name | Type | Description |
|---|---|---|
action? | string | Set to "Upgrade" or "Downgrade" for subscription plan changes. |
code | string | Product identifier. |
qty | number | Quantity 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
| Name | Type | Description |
|---|---|---|
command | string | |
context | Record<string, string> | |
requestid | number | |
result | Record<string, string | number | boolean> | |
status | number | |
statusmessage | string |
EventHandlerStoreChannelCredDataStatus
type EventHandlerStoreChannelCredDataStatus = EventHandler<IStoreChannelCredDataStatus>;EventHandlerUserData
type EventHandlerUserData = EventHandler<IUserData>;EventHandlerUserRegionData
type EventHandlerUserRegionData = EventHandler<IUserRegionData>;IChannelStoreRequest
Custom request object for advanced ChannelStore operations.
| Name | Type | Description |
|---|---|---|
command? | string | |
context? | ResObject<Record<string, string>> | |
params? | ResObject<Record<string, string | number | boolean>> |
IRequestedUserDataInfo
Configuration for the RFI (Request for Information) screen.
| Name | Type | Description |
|---|---|---|
context? | ChannelStoreUserDataContext | Whether the RFI screen is for sign-up or sign-in. |
forceShowData? | boolean | When 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.
| Name | Type | Description |
|---|---|---|
code | string | Product identifier from the Developer Dashboard. |
cost | string | Localized cost with currency symbol. |
freeTrialQuantity | number | Free trial length (e.g., 1 for 1-month, 7 for 7-day). |
freeTrialType | string | Free trial unit ("Days" or "Months"). |
name | string | Item name / description. |
productType | string | Product type (e.g., "MonthlySub"). |
purchaseDate | string | Subscription purchase date. |
qty | number | Quantity (for consumable products). |
status | string | Whether the product is "saved" or "approved for sale". |
trialCost | number | Introductory pricing discounted price. |
trialQuantity | number | Months of introductory pricing. |
trialType | string | Unit for introductory pricing ("months"). |
IChannelCred
Channel credential data returned by the getChannelCred command.
| Name | Type | Description |
|---|---|---|
channelId | string | The app ID (e.g., "2213" for Roku Media Player). |
errorCode | string | Error description; empty string on success. |
json | string | JSON string containing roku_pucid, token_type, channel_data, and error fields. |
publisherDeviceId | string | Unique identifier of the device. |
status | number | Request status; 0 indicates success. |
IDeviceAttestationToken
Device attestation token returned by the getDeviceAttestationToken command.
| Name | Type | Description |
|---|---|---|
nonce | string | The nonce used to generate the token. |
status | number | Request status; 0 indicates success. |
token | string | Signed JWT for device attestation verification. |
IPurchase
Purchase information returned by getPurchases or getAllPurchases commands.
| Name | Type | Description |
|---|---|---|
code | string | Product identifier. |
cost | string | Localized cost with currency symbol. |
expirationDate | string | Subscription expiration date (ISO 8601). |
freeTrialQuantity | number | Free trial length. |
freeTrialType | string | Free trial unit ("Days" or "Months"). |
inDunning | string | Whether subscription is past due ("true" if in dunning state). |
name | string | Item name / description. |
productType | string | Product type (e.g., "MonthlySub"). |
purchaseChannel | string | Where the purchase was made ("web" or "device"). |
purchaseContext | string | How the purchase was made ("isu" or "iap"). |
purchaseDate | string | Purchase date (ISO 8601). |
purchaseId | string | Transaction ID. |
qty | number | Quantity purchased. |
renewalDate | string | Subscription renewal date (ISO 8601). |
status | string | "Valid" for current subscriptions, "Invalid" for canceled/expired. |
statusMessage | string | Description of the status. |
trialCost | number | Introductory pricing discounted price. |
trialQuantity | number | Months of introductory pricing. |
trialType | string | Unit for introductory pricing ("months"). |
IOrderStatus
Status returned by the doOrder command.
| Name | Type | Description |
|---|---|---|
status | number | Completion status (1 = success, 2 = interrupted, 0 = network error, etc.). |
statusMessage | string | Description of the completion status. |
IPurchasesStatus
Status returned by getPurchases / getAllPurchases commands.
| Name | Type | Description |
|---|---|---|
status | number | |
statusMessage | string |
IStoreChannelCredDataStatus
Status returned by the storeChannelCredData command.
| Name | Type | Description |
|---|---|---|
response | string | JSON string with status, error, and error_detail fields. |
status | number | Request status; 0 indicates success. |
IUserData
Roku customer account information returned by the getUserData command.
| Name | Type | Description |
|---|---|---|
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.
| Name | Type | Description |
|---|---|---|
country | string | |
state | string | |
zip | string |
ChannelStoreUserDataContext
Context for the RFI (Request for Information) screen.
type ChannelStoreUserDataContext = "signin" | "signup";Updated about 4 hours ago