# Retrieve a hosted page

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


When you retrieve a hosted page whose `status` is `successful`, the `content` attribute has the following objects based on the `type` of the hosted page.

**`type` of hosted page**

**`content` attribute constituents**

`checkout_new`

-   `customer`: the object representing the details of the [Customer](/docs/api/customers/customer-object) for whom the subscription was created.
-   `subscription`: the new Subscription object created.
-   `card`: the [Card](/docs/api/cards/card-object) object if the [payment method](/docs/api/customers/customer-object#payment_method) `type` used was `card`.
-   `invoice`: the Invoice object, if an invoice was generated.

`checkout_existing`

-   `customer`: the object representing the details of the [Customer](/docs/api/customers/customer-object) whose subscription was changed.
-   `subscription`: the updated Subscription object created.
-   `card`: the [Card](/docs/api/cards/card-object) object if the [payment method](/docs/api/customers/customer-object#payment_method) `type` used was `card`.
-   `invoice`: the Invoice object, if an invoice was generated for the subscription change.

`update_payment_method`

-   `customer`: the object representing the details of the [Customer](/docs/api/customers/customer-object) whose subscription was changed.
-   `card`: the [Card](/docs/api/cards/card-object) object if the new [payment method](/docs/api/customers/customer-object#payment_method) added was of `type` `card`.

`pre_cancel`

`retention`: Use the `bypass` flag in this object to route the cancellation flow to the merchants' portal or the Chargebee Retention.- If `bypass` flag is `true`, you should route the end-customers to your native cancellation flow.

-   If the `bypass` flag is `false`, you should route the end-customers to the hosted page URL. **Note:** Retention is currently in `beta`. To enable Retention, [Contact Support.](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support)

`collect_now`

-   `transactions`: this object should contain a list of [transactions](/docs/api/transactions/transaction-object) triggered from the `collect_now` hosted page. Each transaction in the list should be represented as an array that includes relevant information about the transaction, such as transaction ID, customer ID, amount, currency, payment method, and any other relevant details.
-   `customer`: this object should contain the customer record associated with the transaction. The key, `customer_id` is used to link the transaction to the corresponding customer record.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/hosted_pages/__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = HostedPage.Retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r").Request();

HostedPage hostedPage = result.HostedPage;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    hostedpageAction "github.com/chargebee/chargebee-go/v3/actions/hostedpage"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := hostedpageAction.Retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        HostedPage := res.HostedPage
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  
  res, err := client.HostedPage.Retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r")
      if err != nil {
        fmt.Println(err)
    } else {
        HostedPage := res.HostedPage
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = HostedPage.retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r").request();

        HostedPage hostedPage = result.hostedPage();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.hostedPage.HostedPage;
import com.chargebee.v4.models.hostedPage.params.HostedPageRetrieveParams;
import com.chargebee.v4.models.hostedPage.responses.HostedPageRetrieveResponse;

public class HostedPageRetrieve {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        HostedPageRetrieveResponse response = client.hostedPages().retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r");

        HostedPage hostedPage = response.getHostedPage();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.hostedPage.retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r");

    console.log(result);
    const hostedPage = result.hosted_page;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->hostedPage()->retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r");
$hostedPage = $result->hosted_page;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.HostedPage.retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r")
hosted_page = response.hosted_page
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::HostedPage.retrieve("__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r")

hosted_page = result.hosted_page
```

## Sample Response

```json
{
  "hosted_page": {
    "created_at": 1517506016,
    "embed": true,
    "expires_at": 1517509616,
    "id": "__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r",
    "layout": "in_app",
    "object": "hosted_page",
    "resource_version": 1517506016000,
    "state": "created",
    "type": "checkout_existing",
    "updated_at": 1517506016,
    "url": "https://yourapp.chargebee.com/pages/v3/__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r/"
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/hosted_pages/{hosted-page-id}

## Returns

- `hosted_page` (Hosted page object)
  Resource object representing hosted\_page
