The Tremendous Embed SDK is the easiest way to add rewards and incentives to your application, while maintaining control of your user experience. Within your application, end-users are presented with a white-labeled interface wherein they can choose to receive funds from among a wide catalog of options (.
You can get started immediately with your integration using our sandbox environment. First, sign up to the Tremendous Sandbox Environment.
To generate your tokens, you'll navigate to Settings > API. You will need to generate both a REST API Key and a Developer App to grab your public key which you will add to the client as the
Add the client script to your webpage
Launch the rewards modal
Reward Create Parameters
The payload to create a Reward in the client should mirror that used in the REST API.
JWT encoded reward
When a reward is generated on the front end, execution is paused until it is approved
Approve REST endpoint. For security purposes, the ID and data for the reward is passed as an encoded JWT to prevent client side manipulation.
To fulfill the reward, you will need to complete the following steps:
- Pass this token to your backend
- Decode the token using your private REST access token and the SHA-256 hash algorithm (see example below)
- Validate that the user is entitled to the reward with the given attributes (i.e. the denomination and currency code)
- Issue a
POSTrequest to the Reward Approve endpoint using the Reward ID
Below is a Ruby implementation of JWT. Libraries are available in many other languages see here.
require 'jwt' // We encrypt the token using our private REST access token (retrievable in the dashboard) token = JWT.decode( encoded_token, "[TREMENDOUS_REST_ACCESS_TOKEN]", 'HS256' # Cryptographically sign with HS256 - HMAC using SHA-256 hash algorithm )
Each reward should be uniquely associated with a single reward in your backend datastore. To prevent any possible duplication, this can be achieved by passing a unique
external_id with each order payload.
Triggered when the client is successfully mounted. Passed a single config object to the handler as a parameter.
Triggered when the user completes their redemption selection. The argument passed to the onRedeem handler is a JWT representing the generated reward.
When a reward is created through this client, a final approval step must be taken on the backend via the REST API.
Triggered on any error within the client. An error object is passed to the handler as a parameter.
Triggered when the user manually closes the redemption screen or when the SDK programmatically does so through the