Tutorial: Roku In-App Purchases

Prerequisites

For Roku in-app purchases to be connected to Cleeng's system, the following steps must be completed:

  1. Create a Roku customer account
  2. Enroll as a Roku developer
  3. Register for Roku Partner Payouts Program
  4. Configure in-app products for your Roku channel app

    • Note: Each Roku Product ID should match its Cleeng Offer ID with one minor exception–– becasue the _ (underscore) character is not supported, you must use a - (dash) instead:

      Cleeng Offer ID Roku Product ID
      S123123123_US S123123123-US
  5. Set your Roku push notification URL to this Cleeng endpoint: https://cleeng.com/checkout/roku/push_notifications_endpoint.php

    Push notification URL

  6. Contact Cleeng to finalize Roku in-app purchase setup.

This tutorial assumes that the user is already authenticated and has a customerToken stored in the app. For reference see our authentication tutorial.

Purchase Flow

The Roku channel app is responsible for displaying the “buy" button to initiate the payment. Once successful payment is completed through Roku Billing, the Cleeng receipt endpoint must be notified.

Receipt Endpoint

In order to register a transaction in Cleeng, the receipt data returned from Roku Billing must be passed to the secure Cleeng endpoint for validation. The endpoint accepts a POST request of a JSON payload containing following fields:

  • paymentEvent- this should be set to "new"
  • offerId- the Cleeng offer ID (e.g. S123123123_US)
  • rokuTransactionId- the transaction ID of the purchase returned by Roku
  • customerToken- token identyfing customer account on Cleeng (e.g. ZAP8dgKPIEgBulSZZBdyv1O0wzg1pucyHf8gUGg2X6ZhdRaH)

Validate Access

Payment processing is asynchronous and may take up to 1-2 minutes between purchase and validation in Cleeng. Because of this, the app should grant temporary access to the user while the transaction is processed. However, every time after the inital purchase, the middleware will be the source of truth to check the user's access status.

  • Note: If this is not completed within 1-2 minutes, the app should assume that the payment failed and notify the user.

Roku purchase flow

End User Registration and In-App Purchase Diagram

Roku registration & purchase