Overview
Relay is a hosted JavaScript widget that lets you embed Fruga's cashback rewards experience directly inside your platform - with minimal integration effort.
Relay is designed to be embedded in your web application as an iframe. Your users interact with it without ever leaving your platform, and you stay in full control of where and how it appears.
How it works
Your backend authenticates the user, signs a short-lived assertion, and exchanges it with Fruga for an access token. The Relay widget uses that access token to securely identify the user on Fruga’s side - no separate login required. Once authenticated, users can view their cashback balance, browse offers, and receive payouts.
Relay Integration Flow
Fruga provides four values for your environment: NEXT_PUBLIC_PARTNER_ID, PARTNER_SECRET, PARTNER_KEY_ID and ISSUER. These identify your platform, authenticate your API requests, and sign user assertions.
Add the Relay script to your page. The SDK handles widget mounting, session establishment, versioning, and iframe lifecycle automatically.
When a user loads the widget, your backend signs a short-lived JWT assertion with your PARTNER_SECRET and exchanges it for a Fruga access token. This establishes a verified session without requiring a separate login - and the assertion never passes through the browser.
When a qualifying event occurs (e.g., policy purchase, claim excess reimbursement), your backend submits a cashback claim request to the Relay Partner API. We handle the rest - balance update, payout prompt, and user notification.