Skip to main content
To use the Fluz JS widget, you do two things:
  1. On your page, load the widget JavaScript and bind a UI element (for example, a button) to open the widget modal.
  2. On your server, generate a signed JWT, the pre-approved transaction token (patToken), and pass it to the widget.
This page covers step 2.

What the patToken does

Because the user is moving money into or out of your operator spend account through Fluz, every widget session must carry a signed JWT that pre-authorizes that specific transaction. For example, if user abc123 has $50 in your operator spend account and wants to withdraw it to their Fluz account, your server generates a patToken with transactionType: "WITHDRAW" and amount: 50.00. Fluz validates the token before allowing the transaction. Sign the token with HS256 using your apiSecret, which you can find in your app details under For Developers in Fluz.
Always generate the token on your server. Never expose your apiSecret in client-side code.

Token claims

Required

Never put your API key in the token, and never pass it to the browser. Your API key is your application’s credential: anyone who has it can call the Fluz API as your application. The token is visible in the user’s browser, so identify your application with appId only. The token’s signature, made with your API secret on your server, proves it came from you.

Optional (prefill user details)

Optional (enrollment)

Generate the token

Pick your language from the dropdown. Each example includes the install command at the top and signs the required claims; add any optional claims to the same payload.
JavaScript (Node.js)