WebView
This guide covers how to integrate the Kard Rewards WebView in your mobile or web application.
Introduction
Kard’s Rewards WebView provides a turnkey front-end offers experience, complete with a rewards map and intuitive offer discovery for their users. Issuers can integrate Kard’s WebView seamlessly into their existing experiences allowing them to launch and iterate on their rewards program quickly and easily.
It is designed to be embedded in:
- Mobile apps via native WebView components (iOS WKWebView, Android WebView, React Native WebView)
- Web applications via iframe
Environment URLs
Query Parameters
token (required)
A JWT authentication token that identifies the user and organization.
Required JWT claims:
The token is used for API authentication when the WebView makes requests to Kard services.
theme (optional)
A base64url-encoded JSON string containing design token overrides for customizing the appearance. Uses RFC4648 base64url encoding which is URL-safe (uses - instead of +, _ instead of /, and omits padding). No encodeURIComponent is needed when using base64url encoding.
Structure:
Color & theme tokens (styles.light / styles.dark)
These tokens are mode-dependent and can differ between light and dark themes:
All color values must be valid CSS color values (hex, rgb, hsl, oklch, named colors, etc.).
Layout tokens (styles.layout)
These tokens are mode-independent and apply to both light and dark themes:
labels (optional)
The labels property within the theme parameter allows customization of page titles displayed in the WebView. All label properties are optional — if not specified, the default values are used.
Fetching a WebView JWT Token
The Kard SDK provides methods to generate WebView tokens. The SDK is available in multiple languages:
SDK Method:
This returns a signed JWT that should be passed as the token query parameter.
WebView tokens can also be generated via REST API. Refer to the API documentation for Get WebView Token.
Location Message Passing Contract
The WebView uses a message-passing protocol to request location data from the container application. This is required for the rewards map feature to display nearby offers.
Message Types
Request Format (from WebView)
When the WebView needs location data, it sends:
Success Response Format (to WebView)
When location is successfully retrieved:
Coordinate fields:
Error Response Format (to WebView)
When location cannot be retrieved:
Platform Integration Examples
React Native
iOS (Swift)
Android (Kotlin)
Web (iframe)
Theming Resources
Below is an example showing how to apply custom branding: