[API Users] How to generate hosted page URL and embed via iFrame

Modified on: Fri, 2 Aug, 2019 at 7:21 PM

This article covers:

Hosted pages API


This article applies for hosted pages V2.


If you want to integrate with Chargebee using iFrame, you can use the Hosted Pages APIs. 

To create a new subscription, you can generate the hosted page URL using the "Checkout New Subscription" hosted page API call. To checkout an existing trial subscription, use the Checkout Existing Subscription.


Chargebee will return a response with the checkout URL. Below is a sample snippet for reference, which can you load in your Iframe.


{"hosted_page": {
    "id": "7R24UkirlHejZgMgUQt9ea*******5S",
    "type": "checkout_new",
    "url": "https://yourapp.chargebee.com/pages/v2/7R24UkirlHejZgMgUQt9eahrkOu7ZO5S/checkout",
    "state": "created",
    "embed": true,
    "created_at": 1528093752,
    "expires_at": 1528097352,
    "object": "hosted_page",
    "updated_at": 1528093752,
    "resource_version": 1528093752000
}}


Additionally, you can the return URLs for hosted payment page so that the customers are redirected to this page upon successful checkout. To configure the Redirect URL for checkout page generated using the APIs, navigate to Settings > Configure Chargebee > Checkout & Self Service Portal.

 

You can also configure the “Cancel URL” here to redirect customers to a link when they’d like to cancel the subscription.

 

 

 

Customers will be redirected to the above-configured URL after successful signup using the generated hosted payment page.



Related articles and documentation:

Implementing an in-app hosted checkout 



Did you find it helpful? Yes No

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