- Viewing current subscriptions and plans
- Upgrading, downgrading, or cancelling subscriptions
- Updating payment methods and billing information
- Viewing invoices and payment history
When to Use the Customer Portal
Use the Customer Portal when you want to:- Provide a single entry point for customers to manage all their billing and subscriptions
- Avoid building your own “My Account / Billing” UI
- Offer self-service experiences (change plan, update card, view invoices) after checkout
- Link to a hosted page from your app’s “Billing” or “Account” menu
Change Subscription After Purchases (Hosted Mode).
How It Works
The integration pattern is similar to the Subscription Update page:- Your backend calls a Session API to get a Customer Portal URL for a specific user.
- Your frontend redirects the user to that URL.
- The user completes actions in the hosted Customer Portal.
- UniBee redirects the user back to your
returnUrlorcancelUrl, and sends relevant Webhooks (e.g. subscription updated, invoice paid).
Generate Customer Portal URL (Session API)
You generate the Customer Portal URL via the Session API: API Endpoint: Get Customer Portal URLRequest Behavior
-
User identification:
- If
userIdis provided, UniBee uses it directly. - If
userIdis0, UniBee will tryexternalUserIdfirst, thenemail. - If no user is found, the API returns
user not found.
- If
-
Subscription resolution:
- UniBee will try to find the most relevant subscription for this user (optionally filtered by
productId):- Prefer the latest active / incomplete / creating subscription.
- Fallback to the latest subscription record.
- If a subscription is found, the portal URL will include
subscriptionIdso the portal can focus on that subscription. - If no subscription is found, the portal URL is still valid (without
subscriptionId) and the user can start their first purchase from the portal.
- UniBee will try to find the most relevant subscription for this user (optionally filtered by
-
Return URLs:
returnUrl: where the user is redirected after completing actions in the portal.cancelUrl: where the user is redirected if they cancel or close the portal without completing actions.
Redirect the Customer
After calling the Session API from your backend, redirect the user to the returned URL:Handle Return Callback
After the customer finishes in the Customer Portal, UniBee redirects them back to yourreturnUrl (or cancelUrl).
You can handle the callback similarly to the checkout / subscription update flows:
subscription.update.successsubscription.pending_update.successinvoice.paid

