Skip to main content
When your customers are already signed in to your own application, they should be able to change their plan there without switching to Fynn and signing in a second time. You embed the plan page as an iframe. Three things stay right while you do: your frontend never holds an API token, payment data never touches your DOM, and the truth about the contract still lives in the webhooks.

The flow

1

Create the session in your backend

Your backend requests a portal session with the scope plan-change and passes the token to your frontend. A session with that scope cannot reach invoices or payment methods.
2

Allow your domain

The domain of your application has to be listed as an allowed origin for the sales channel. Without that entry the two sides exchange no messages. Send it to support@fynn.eu to have it added.
3

Embed the iframe

The page lives on the portal domain of your sales channel:
4

Listen for events

The embedded page reports its height and every decision the customer makes.
Embedded plan page stating that this subscription has no plan change

The embedded plan page, here for a subscription without a plan tier.

The language comes in with the portal session. If a customer switches the language in your application, send fynn:locale instead of remounting the iframe.

Events

Messages from the iframe to your page: Messages from your page to the iframe:
Check event.origin before you act on a message. Fynn does the same in the other direction: messages from a domain that is not allowed are dropped, and outgoing messages go only to the allowed domains, never to arbitrary recipients.

Theming

The look comes from the branding of your sales channel: colour, logo, font and corner radii are already set when the page loads. To match it to your product at runtime, send CSS variables:
Common variables:

When the session expires

A portal session lasts 15 minutes by default. When it expires, the embedded page says so and emits fynn:session-expired. Fetch a fresh session from your backend and remount the iframe. Nothing is stored in the browser, so remounting costs nothing.

What is binding

fynn:plan-changed exists so your interface can update immediately, for example to close a dialog. The webhook is what is binding. If your application stores the new plan itself, do it when the webhook arrives, not when the message from the iframe does.