Skip to main content
The Customer Portal APIs are the customer-facing half of Flexprice. They authenticate with a portal session token rather than an API key, and every request is scoped to the one customer that token names. Use them if you build your own portal front end, or embed portal actions in your product. For how to obtain a token, see Customer Portal.

Authentication

Send the session token in the X-Session-Token header:
The session token is a credential. Do not log it, put it in a URL you send to a third party, or hand it to a payment provider as a return URL. See how the portal builds return URLs in Portal payments.
A suspended tenant’s portal endpoints stop serving requests, the same as the rest of the API.

Customer

Subscriptions

Invoices

Pay an invoice

There is no amount field. The charge comes from the invoice, so a customer cannot part-pay.

Wallets

Top up a wallet

idempotency_key is required. Omit checkout entirely to raise an invoice for the top-up instead of charging now. Credit reason, expiry and priority are pinned server-side and cannot be set from the portal.

Configure auto top-up

Send cooldown as { "value": 0, "unit": "hour" } to clear a stored cooldown. null leaves the existing one in place.

Checkout sessions

completed means the gateway finished, not that the wallet transaction exists yet. It is written by the provider’s webhook, which can land a moment later. Recheck the wallet rather than assuming the balance from the status.

Payment methods

Delete and default both take payment_provider and payment_method_id. Adding returns a SetupAction, not a payment method, because nothing is stored until the customer completes the provider’s form.
action.url is an unconstrained API string. Refuse any scheme that is not http or https before opening it.

Integrations and configuration

/integrations is derived from the tenant’s published connections. Use it to decide which actions to render rather than hard-coding a provider. See the capability matrix.

Analytics

Cost analytics returns your cost to serve the customer and your margin on them. Do not render those figures in a customer-facing surface.

Errors

Portal errors carry a hint written for the customer. Common ones:

Customer Portal

Sessions, sections and the security model

Portal payments

The flow behind each payment endpoint

Portal configuration

The schema returned by /config

API Reference

The full Flexprice API