Popup customer portal
This guide covers the customer portal integration from a developers point of view. It assumes that you have already setup your Products in Bunny and enabled them to be visible for self service.
This integration involves adding a Bunny hosted javascript SDK to your application and calling methods on the SDK to popup the subscription management and payment options.

Overview
There are 2 steps in this integration.
From your applications backend, generate an token via the Bunny API. This token will be required in step 2 to authenticate access to the portal.
Add the
bunny.jsscript to your application then use a link on your page to popup the portal.
1. Setup API credentials
We recommend setting up a new API client specifically for customer portal access. You can learn how to setup an API client here.
The API client will need to have the security:read and security:write scopes enabled.
Use the API client to generate a new access token with the security scopes.
Request a portal token
Make a request from your backend to obtain the portal security token using the portalSessionCreate graphql request.
Attributes
Mutation
On success the response will contain a token attribute. You need to extract this token and use it in the next step.
2. Include the bunny.js script
Include the Bunny script in the <head> section of your application using the subdomain of your Bunny account.
Now initialize the script by passing the portal token from step 1 into the Bunny SDK.
Finally add a button or a link to your site for upgrading or managing a subscription with a click handler that we will use to popup the portal.
Controlling the display
You can popup different screens by setting a page argument in the popup method.
Last updated
Was this helpful?
