How can I setup a simple hosted payment page using addons & discounts without resorting to API?

Our hosted payment page is a simple URL available at the "Plan" level. Using this you can quickly link any website to accept payments via Chargebee. 

Now this got more awesome with some advanced features. 

You can now make a bundled offering including addons and discounts without any API calls, just by including these details in the plan specific hosted page URL.

Here is how you can set it up:

Look for "Hosted page URL" at the bottom of your plan details page. 

All plan URLs will look something similar to this:

1. Specifying plan quantity: 

If you have a single plan but with different quantities, you can specify the plan quantity in the URL and Chargebee will calculate the cost and display the total charge on the hosted page.

Sample URL:<plan-id>?subscription[plan_quantity]=2

2. Apply a default coupon discount during sign up: 

When you would like to offer a discount to certain coupons without allowing users to key in a coupon code themselves, you can create a URL using the coupon code yourself. 

Sample URL:<plan-id>?subscription[coupon]=<coupon-id>

Example Scenario:

Apply a setup fee and postpone the initial payment to the second billing cycle: 

For certain business models, merchants may want to charge their customers just the setup/installation fee during sign up and charge them on the second month. To get this done, create a plan along with its setup fee, and a coupon with the plan cost as the discount amount. Specify this coupon in the URL. When the customer signs up, their first month's plan cost will be waived off and they will only be charged for the setup fee. 

This is also displayed to them on the hosted page.

3. Include an addon during sign up: 

If you are selling a particular product and as an addon you want to allow customers to purchase an additional product/service, you can include this as an addon in the plan URL. 

Sample URL:<plan-id>?addons[id][0]=<addon-id>

4. Include an addon with quantity during sign up: 

For quantity based addons you would specify the addon as well as the quantity amount in the URL.

Sample URL:<plans-id>?addons[id][0]=<addon-id>&addons[quantity][0]=2

5. A Plan URL with all of the above:

Here's a sample URL for creating a subscription that includes subscription ID, plan quantity, addon with quantity and coupon.

Sample URL:<plan-id>?subscription[id]=<unique-id>&subscription[plan_quantity]=2&addons[id][0]=<addon-id>&addons[quantity][0]=2&subscription[coupon]=coupon-id

Sample Demo:

Placeholders used in the URL

subscription[id]=<unique-id> - This is the placeholder that you would use if you want to specify a subscription ID. If you are going to explicitly specify a subscription ID please make sure it is unique. This placeholder is NOT mandatory.

subscription[plan_quantity]= - You can specify the plan quantity after "=". 

addons[id][0]=<addon-id> - [0] specifies the number of the addon. So if you are going to include 2 addons to the subscription, then the URL will look something like:


The <addon-id> is where you would enter the ID of the addon. You can find the ID by clicking on an existing addon.

addons[quantity][0]= - Used to indicate the quantity of the addon to be included in the subscription. Specify the quantity after "=".

subscription[coupon]= - Used to specify the coupon that needs to be applied to the subscription. Specify the coupon ID after "=".

subscription[trial_end]= - Used to override the default trial period. Specify the time in the Unix Timestamp format in UTC.

Use "?" at the end of the plan ID and "&" for each placeholder. "&" is not required after the "?" that is used after the plan ID.

<> - Do not include this when specifying your values like plan id or addon id.

A limitation for quantity based plans or addons when using this method is that your customers will not be able to choose or edit the quantity on the hosted page. As a workaround you can create a quantity drop down on the plan page of your website, and based on the input your customers enter, generate the URL along with the value specified.

Drop us a comment if you have a question or would like to add something.

4 people like this idea

Bee. I can do it easily after your reputed guide. 

Hi Joseph 

I believe my colleagues have reached out to you and have answered this query over chat. For security reasons, we do not allow price overriding via URL. Hope this helped answer your query. 

Hi Meena, 

is it possible to overwrite other parameters using a URL checkout link ?

Would that exemple be correct ?<plan-id>?subscription[plan_quantity]=10&Plan[unit_price]=1&Plan[setup_fee]=1000

Hi Russ

You can either construct the URL manually adding the plan and addons IDs or use the API to generate the checkout page. We do not have any other alternatives to this. 

yes I know I can construct the URL myself, but it is a bit of a PITA having to do this every time I want to send a link to a client.

Hi Russ,

You do not see this option because you are in our latest version of checkout pages. 

However, you can construct this URL at your end. The URL is like this:

You have to edit the 'sitename' and 'plan_id' to this to construct the URL. 

Hope this clarifies. 

on this page:

it says "To get the plan specific hosted page URL click on a plan name and open it in the web interface, you will find the URL at the bottom of the page."

But I do not see the URL at the bottom.

All I have is

Hosted Page & Customer PortalDisplay in Customer PortalEnabled 
If enabled, users can switch to this plan using the 'Edit Subscription' option.Checkout using Hosted PageEnabled 
If enabled, users can access the checkout page via drop-in script. To change, click here.Drop-in Script

View Grab Script Customize Checkout and Portal Settings


Thanks Meena, I missed this important detail.


Hi Borek

You should be adding the extra parameters to the plan's hosted page URL and not the checkout page that is rendered on using the hosted page URL. 


Considering the plan shown above as an example, your hosted page URL would be:

The additional parameter should be added to the hosted page URL and it'll appear as below:[plan_quantity]=3

1 person likes this

How to do this with Pages v2? For example, our URL[plan_quantity]=3

does not influence the unit number.

Hi Martijn

I'm afraid it's not possible at the moment to control hosted pages fields on per subscription level. Field configurations are a site-wide setting and will apply for all the sign-ups. 

For trial users who are within your app, will their accounts be created in Chargebee when they sign-up or will you be doing that only when they go for a paid plan? 

Thank you that works. But it seems this can only be set site-wide. I have 2 signup forms: one from within the application that trial users can open to convert to a paid plan. For these users we already know the email adress and the amount of units.

The second form will be on the website for a direct signup. For these users we dont know anything yet so the email field should be editable.

How can i configure this per subscription?

Hi Martijn

You can make this field read-only by going to Settings > Hosted Pages Settings > Field Configurations and make the email field as Read-Only to ensure customers' do not edit the email address. 

Let me know if that helps.

Hi, i found out how to send the email adress to the form. Is there a way to grey-out the email adress field to prevent a user from changing the email adress? In order to identify the subscription with the according account we need to make sure that the email adress used to sign up is the same as the email used to subscribe.


1 person likes this

Using multiple gateways - signup subscriptions through specific payment gateways via hosted payment page

What if you want to have some of your customers signing up for a lower priced plan to go through one gateway & others through another gateway? 

Now you can accomplish this by passing card[gateway] parameter as part of the URL.

Sample URL:<plan-id>?card[gateway]=stripe<plan-id>?card[gateway]=authorize_net

For a full list of specific payment gateway ids that can be used refer this documentation:

Login or Signup to post a comment