Start a new topic

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: https://yoursitename.chargebee.com/hosted_pages/plans/plan_id


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: https://yoursitename.chargebee.com/hosted_pages/plans/<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: https://yoursitename.chargebee.com/hosted_pages/plans/<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: https://yoursitename.chargebee.com/hosted_pages/plans/<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: https://yoursitename.chargebee.com/hosted_pages/plans/<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: https://yoursitename.chargebee.com/hosted_pages/plans/<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: https://www.chargebee.com/labs/signup-with-addons-and-quantity.html


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:


addons[id][0]=<addon-id>&addons[id][1]=<addon-id>&addons[id][2]=<addon-id>


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

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: https://yoursitename.chargebee.com/hosted_pages/plans/<plan-id>?card[gateway]=stripe

https://yoursitename.chargebee.com/hosted_pages/plans/<plan-id>?card[gateway]=authorize_net


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


https://apidocs.chargebee.com/docs/api/hosted_pages#checkout_new_subscription


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.


Thanks,
Martijn

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.

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


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? 

How to do this with Pages v2? For example, our URL


https://ourapp.chargebee.com/pages/v2/8Hy2Zcd8zgmr2BgDafCCQUjFK7RTKncdYA/checkout?subscription[plan_quantity]=3


does not influence the unit number.

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. 


image


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


https://ourapp.chargebee.com/hosted_pages/plans/cbdemo_seedfun


The additional parameter should be added to the hosted page URL and it'll appear as below:


https://ourapp.chargebee.com/hosted_pages/plans/cbdemo_seedfun?subscription[plan_quantity]=3




1 person likes this

Thanks Meena, I missed this important detail.


Borek

on this page: https://www.chargebee.com/docs/hosted_pages.html#1-plan-url-integration

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

 

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: 


https://sitename.chargebee.com/hosted_pages/plans/plan_id


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


Hope this clarifies. 

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 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. 

Login or Signup to post a comment