How to Generate the hosted page URL? - PC 1.0

Modified on: Thu, 8 Jun, 2023 at 4:52 PM


This article also covers
How to close the checkout page when opened in a new tab?

What is the plan URL syntax that could be shared with my customers to checkout?

What is the syntax for accessing the link to the customer portal?

Item-specific hosted page URL for one-time charges in PC 1.0. 

How to create a checkout URL for One Time checkout in PC 1.0 sites?


Note: If you are using PC 2.0, refer this article to create the checkout URL.


Solution


You can manually generate a plan-specific checkout URL and embed this on your website. On click, customers would be directly taken to a checkout page in a new tab where they would be able to enter their payment information.

 
Here’s the syntax for generating the plan-specific checkout page URL

 

your-domain.chargebee.com/hosted_pages/plans/plan_id
 

With the hosted page URL, you can pass additional customer and subscription information during sign up. These details need to be passed on to the hosted page URL while redirecting users to the hosted checkout page.

 

Here’s the syntax for generating the one-time checkout page URL

One time checkout is different from the normal checkout and so normal hosted page URLs cannot be used for one time charges by simply changing the items in the URL.

The correct format for creating the URL for one time charges is the below.

https://<your-domain>.chargebee.com/hosted_pages/checkout/onetime?addons[id][0]=<addon_id> 

Here, you need to replace <your-domain> with your Chargebee domain name and the <addon_id> with the id of the item that you want to create the checkout for. 


Here’s the syntax to specify plan quantity during sign up

your-domain.chargebee.com/hosted_pages/plans/plan_id?subscription[plan_quantity]=number

NOTE: This applies only for plans with unit-based pricing model (Stairstep, Volume, Tiered)

Here’s the syntax to include addon during signup

your-domain.chargebee.com/hosted_pages/plans/plan_id?addons[id][0]=addon_id&addons[quantity][0]=number

 
NOTE: "[quantity][0]=number" is optional and can be used for quantity based addons.

Adding multiple parameters


Account information, billing address & shipping address ‘First name’, ‘Last name’, and other customer details can be prefilled whereas Card information cannot be prefilled as it needs to be updated using the token from the payment gateway. 
 Please refer to this link to know more. 

 

To pass multiple parameters (whether it is subscription ID, plan quantity, addons or coupons) to the plan specific hosted page URL when creating a subscription, use an "&" symbol to separate parameters.

 

To illustrate, here is a sample URL for creating a subscription that includes subscription ID, plan quantity, addon with quantity and a coupon with each parameter separated by an "&" symbol:

 

https://yoursitename.chargebee.com/hosted_pages/plans/ ?subscription[id]= &subscription[plan_quantity]=2&addons[id][0]= &addons[quantity][0]=2&subscription[coupon]=coupon-name


Sample URL with the first name


http://flipbook-test.chargebee.com/hosted_pages/plans/Nexplore?customer[email]=anyemail@chargebee.com&customer[first_name]=Sony&billing_address[first_name]=Sony


Completing the checkout process- Closing the session


Since the Checkout page is generated using a URL in a new tab, the only way to close the checkout page is by closing the browser tab.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×