Create and assign a custom plan for a user
Create a custom plan
The creation of custom plans is a two-step process. First, you need to create the plan in the Bugfender server and then create the plan in Stripe. Once you have done this, you can assign the plan to a user.
To create a custom plan, the process will be different depending on the server you need to create the plan for.
Bugfender SAAS (dahsboard.bugfender.com)
Create the plan in the config file
- In the bugfender-helm repo, edit
charts/all-in-one/templates/common/config-map.ymland add your plan in thebugfender.confProducts entry. - Deploy the chart to the server (merge the changes to main)
After this, the plan will be available in the system, but it will not be assigned to any user neither will it be available in Stripe. The plan in Stripe will be created automatically when the plan is used in the purchase process for the first time.
If you are creating a custom plan, you must use Available: false to hide it from the UI, so no other customers can view/select it.
Create the plan in Stripe
If you want to create the plan in Stripe, Bugfender will do it automatically when the plan is used in the purchase process for the first time. If you want to assign the plan to a user before it is used in the purchase process, you can force the creation of the plan in Stripe by doing the following:
-
Log in to the Bugfender dashboard as the user you want to assign the plan to (in fact, this will work with any user).
-
Open the Web Developer Tools and visit this URL (edit team ID):
-
Check the network tab for a call to
/billing/subscription/preview -
Copy that request as fetch. You should get something similar to:
fetch("https://dashboard.bugfender.com/api/team/2/billing/subscription/preview", {
"headers": {
"content-type": "application/json",
"sec-ch-ua": "\"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\""
},
"referrer": "https://dashboard.bugfender.com/3/team/2/plan/subscription/BUSINESS9/customization-and-payment?currency=USD&interval=MONTH&logs=25",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{\"plan_code\":\"BUSINESS9_25_MONTHLY_USD\",\"billing_details\":{\"name\":\"Aleix\",\"address\":{\"line1\":\"Sant Joaquim 25\",\"line2\":null,\"city\":\"El Prat de Llobregat\",\"country\":\"ES\",\"postal_code\":\"08820\",\"state\":\"Barcelona\"},\"vat_id\":\"ES47150552T\",\"email\":\"\"}}",
"method": "POST",
"mode": "cors",
"credentials": "omit"
});
- Edit the request to use the new plan code and change the
plan_codeto the new plan you want to create and you have used in theconfigfile.- Be aware that the new plan code should be similar to
<plan_code>_<period>_<currency>. - Ex: If you want to create a new plan with code BUSINESS_9, you will need to take into consideration the billing period and the currency, so the code to use will be similar to:
BUSINESS9_25_MONTHLY_USD
- Be aware that the new plan code should be similar to
- Be aware of the
"credentials": "omit"in the request. This means that the request will not be authenticated, so you need to change it to"credentials": "include"if you want to authenticate the request. - Now you can execute the request in the console (add
awaitat the beginning). You should get a response with the new plan created in Stripe. - Check that the upgrade calculation is done correctly.
Change the plan - Automatic
In most of the cases, if you have been able to login with the customer email and everything looks fine with the preview, you can easily change a customer plan running another fetch request. Just replace /preview with /upgrade to upgrade and the plan should be changed.
Change the plan - Manual
Sometimes the automatic process is not suitable as there are special things that needs to be done manually. Ex: you want to change the customer invoicing currency, customer wants to change the payment method, etc.
For this cases, once you have the plan created in Stripe, these are the steps:
- Go to Stripe and find the customer. You can search for the team name or look in the database for the team field
stripe_customer_id(If customer wrote in Intercom, there's might be a link there to go directly to Stripe) - If there's an active subscription, cancel it
- Create a new subscription in Stripe
Bugfender will automatically update the subscription in the system.
Be aware that if you create a new subscription in Stripe, you need to set the following metadata in the subscription:
overage_limit: The PAYG budget for the team.po_number: [optional] If the customer provided a purchase order number, you can set it here.
You can find the metadata in the subscription page in Stripe.