Richie Paywall JavaScript API

Communication with the native client

JavaScript API

Paywall HTML files can communicate with the native apps using Paywall JavaScript API which is provided by the richiePaywall.js file. You must include this JS file as part of your Paywall HTML implementation.

In addition to the functions listed below, all functions of Richie JavaScript API are directly usable in Paywall HTML pages.



Returns true if current paywall is running inside an iOS app, false if it's running on Android.


richie.paywall.didSignIn(email, userID, userToken)

This function must be called from the sign-in.html page after user has successfully received the user token from publisher's authentication backend. Native apps will store the userToken and use it to authenticate subsequent requests. userToken will be refreshed using publisher's authentication backend by the native apps directly (without use of the paywall HTML flow) each time when the application is brought to the foreground.


  • email: The e-mail address which was used for the login. This value will be displayed to the user in settings view.
  • userID: Publisher-specific user ID. This value may be used for analytics purposes.
  • userToken: User token which is generated by the publisher's authentication backend. For more details about supported user token types, contact Richie directly.


richie.paywall.setContextListener( function (context) { … } )

Paywall provides a generic context listener API which is used to pass status information from native app to the paywall HTML files. The context object provides the following fields (availability of the fields depends on the context in which context object is received and how current app is configured):

  • context.paywall.free_articles_left: How many unused metered accesses current user has left
  • context.iap_products.subscription_products: Array of objects describing IAP products which may be purchased
  • context.user: If user is logged in, contains a user object.
Copyright © 2019-2020 Richie Ltd. Based on the documentation site of Tailwind CSS.