# Tutorial: Upgrade Existing Subscription
Say a customer in trial wants to upgrade to a paid plan. You can use Chargebee's checkout for the upgrade. Chargebee's checkout is PCI DSS compliant, hence sensitive card information will not be handled by your servers.
# Honey Comics- Demo Application
Honey Comics, a demo application, is a fictitious online comic book store providing subscription services for comics. They send comic books weekly to their subscribers. To let the customers try the service, they provide one month's free trial. The user can upgrade to a paid plan on the website. Customers will be charged immediately on upgrade. Click here (opens new window) for a demo. The steps below will help you build an app similar to the demo.
In the sample implementation, to simplify code:
- You won't be using any database.
- You won't have real login implementation, hence user id will be hard coded.
To upgrade a subscription via API, you must:
- Signup/Signin to your Chargebee account (opens new window).
- Create a new plan with a trial period in your Chargebee TEST site.
- Grab the Chargebee API (opens new window) key of your Chargebee TEST site.
# Build the upgrade page
Build a page where users can upgrade. When the user clicks on the upgrade button/link, Chargebee checkout will open.
# Setup the client library
Download and import (opens new window) the client library of your choice. and configure the client library with your Chargebee TEST site name and API key.
# An endpoint that returns a hosted page object
On the server side, Chargebee's checkout existing subscription API (opens new window) is used to create a hosted page object for upgrading the subscription by passing the trial subscription id.
# Bind checkout opening with the click event
On the client side, a function like
openCheckout that returns a Promise object can be a result of an ajax call, which is done to the endpoint which we created in the previous step, and this must resolve to a hosted page object.