Billing & backend tokens
Stripe payment links, customer portal, and the long-lived tokens the extension uses to talk to your backend.
Two related admin areas live in the Admin Dashboard: Billing (Stripe configuration) and Backend (extension tokens). They're documented together because both control how end users experience the upgrade-and-connect path.
Billing tab
| Field | Purpose |
|---|---|
| Pro upgrade link | Stripe Payment Link for the Pro plan. Opens in a new tab when a Free user clicks Upgrade. |
| Enterprise contact link | URL to a contact form or Calendly link. |
| Customer Portal URL | Stripe Customer Portal link, used by the Stripe Account tab's Cancel button. |
| Success URL | Where Stripe redirects after a successful payment. Default: https://teleperson.com/welcome?upgraded=1. |
| Cancel URL | Where Stripe redirects on payment cancel. Default: https://teleperson.com/. |
The extension surfaces these via the Stripe Account tab; no Stripe API key is ever exposed to the extension.
Plan-to-Stripe mapping
When a payment completes, Stripe fires a webhook to your Teleperson
Edge Function (stripe-webhook). The function:
- Looks up the customer by
stripe_customer_idorcustomer_email. - Maps the Stripe
price_idto a Teleperson plan (free,pro,enterprise) via theplan_price_mapconfig in the General tab. - Updates
users.planandusers.plan_changed_at. - Audit-logs the change.
If a user upgrades on Stripe but doesn't appear in your tenant within a minute, check the webhook logs in Supabase.
Backend tab
The Backend tab manages extension tokens — the long-lived tle_…
strings the extension sends in the X-TLE-Token header to authenticate
to your Supabase backend.
| Action | Effect |
|---|---|
| Issue new token | Generates a fresh tle_… token for the calling user, copies it to clipboard, and stores its SHA-256 hash in extension_tokens. |
| Revoke token | Deletes the token's row in Postgres. Active sessions on that token start failing on next request. |
| Web app URL | Used to deep-link from the extension to https://<tenant>.teleperson.com/ConnectExtension when a user needs to issue a token. |
Tokens are stored as SHA-256 hashes, never plaintext. If a user loses their token, it can't be recovered — only revoked and replaced.
Plan gating in Edge Functions
Many features are plan-gated. The pattern in every Edge Function:
const user = await getCallingUser(req); // resolves token → user_id → plan
if (user.plan === 'free' && featureRequiresPro) {
return new Response('Premium feature', { status: 402 });
}402 Payment Required is the convention for plan-gated denials. The
extension recognizes this status and surfaces an upgrade prompt that points
at the configured Pro upgrade link.
Related
- Stripe Account (end-user) → — what the user sees.
- Authentication → — the
X-TLE-Tokenmodel.