If you are integrating with ChargeBee using iFrame, you should use the "Hosted Pages" API.

For example, to create a new subscription, you need to generate the hosted page URL, and for this you would use the "Checkout New Subscription" hosted page API call.


When you make this call, you get a response from ChargeBee along with the URL. Below is a sample snippet for reference.

$planID="<replace-with-your-planID>"; //get it from chargebee console
$result = ChargeBee_HostedPage::checkoutNew(array(
  "subscription" => array(
  "planId" => "$planID"
  "embed" => "false"
$hpUrl = $result->hostedPage()->url;
echo  '<iframe src="' . $hpUrl . '" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>';

Also, make sure you have configured the return URLs for hosted payment page in settings -> hosted_pages_settings -> configuration -> Return URLs

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