Checkout validation
A webhook that lets you check if a plan or quantity change is allowed before the user can checkout.
Last updated
Was this helpful?
A webhook that lets you check if a plan or quantity change is allowed before the user can checkout.
Last updated
Was this helpful?
When a user attempts to upgrade or change their subscription using the Bunny portal we call this a checkout.
In some cases you might want to check if the plan or quantity change should be allowed before letting the user proceed.
For example, you have a customer on a plan that includes 10 users and they have created 10 users on your platform. If they then tried to downgrade to a plan that only had 5 users you could use this webhook to block the change and provide a message explaning that they need to delete or deactivate some users before they can proceed with the change.
To enable this webhook you will need to ensure that you have .
Then on your platform enable the Checkout validation option.
The payload that will be sent will contain information about the tenant on your platform that is requesting a change and the features and quantities that they will be change to.
If you wanted to validate the number of users you would use the Tenant code to look up the relevant tenant in your application, get a count of the users and then compare this to the number of users requested in the checkout validation payload.
If you opt-in to using the checkout validation webhook you must respond within 5 seconds with one of the following decisions.
The user will be allowed to continue with the subscription change.
No response body is required and will be ignored if provided.
The user will not be able to continue and will be displayed the error message that you provide.
The required JSON response body is an array of strings that explain why the subscription change is not possible.