# Checkout one-time payments

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


[Idempotency Supported](/docs/api/v2/pcv-1/idempotency)

Create a Chargebee hosted page to accept payment from a customer and checkout [non-recurring addons](/docs/api/v2/pcv-1/addons/addon-object#charge_type) and [one-time charges](/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge).

The following steps describe how best to use this API:

1.  Call this endpoint, providing [non-recurring addons](/docs/api/v2/pcv-1/addons/addon-object#charge_type), [one-time charges](/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge), [coupons](/docs/api/v2/pcv-1/coupons) and a host of other details such as billing and shipping addresses of the customer, to be prefilled on the checkout page.
2.  Send the customer to the Checkout `url` received in the response.
3.  Once they complete checkout, the non-recurring addons and one-time charges are automatically invoiced against the respective `customer` record in Chargebee, and they are redirected to the `redirect_url` with the `id` and `state` attributes passed as query string parameters.
4.  [Retrieve the hosted page](/docs/api/v2/pcv-1/hosted_pages/retrieve-a-hosted-page) at this stage to get the invoice details.

## Sample Request

### Creates a checkout with non-recurring addon

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
     -u {site_api_key}:\
     -d "customer[id]"="__test__3Nl7Oe7SJWjx905b" \
     -d "addons[id][0]"="non_recurring_addon" \
     -d "addons[unit_price][0]"=2000 \
     -d "addons[quantity][0]"=2 \
     -d "billing_address[first_name]"="John" \
     -d "billing_address[last_name]"="Doe" \
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[state]"="California" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US" \
     -d "shipping_address[first_name]"="John" \
     -d "shipping_address[last_name]"="Mathew" \
     -d "shipping_address[city]"="Walnut" \
     -d "shipping_address[state]"="California" \
     -d "shipping_address[zip]"="91789" \
     -d "shipping_address[country]"="US"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = HostedPage.CheckoutOneTime()
		.CustomerId("__test__3Nl7Oe7SJWjx905b")
		.AddonId(0, "non_recurring_addon")
		.AddonUnitPrice(0, 2000)
		.AddonQuantity(0, 2)
		.BillingAddressFirstName("John")
		.BillingAddressLastName("Doe")
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressState("California")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.ShippingAddressFirstName("John")
		.ShippingAddressLastName("Mathew")
		.ShippingAddressCity("Walnut")
		.ShippingAddressState("California")
		.ShippingAddressZip("91789")
		.ShippingAddressCountry("US")
		.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"
    "github.com/chargebee/chargebee-go/v3/models/hostedpage"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := hostedpageAction.CheckoutOneTime(&hostedpage.CheckoutOneTimeRequestParams{
        Addons : []*hostedpage.CheckoutOneTimeAddonParams{
            {
                Id : "non_recurring_addon",
                UnitPrice : chargebee.Int64(2000),
                Quantity : chargebee.Int32(2),
            },
        },
        Customer : &hostedpage.CheckoutOneTimeCustomerParams{
            Id : "__test__3Nl7Oe7SJWjx905b",
        },
        BillingAddress : &hostedpage.CheckoutOneTimeBillingAddressParams{
            FirstName : "John",
            LastName : "Doe",
            Line1 : "PO Box 9999",
            City : "Walnut",
            State : "California",
            Zip : "91789",
            Country : "US",
        },
        ShippingAddress : &hostedpage.CheckoutOneTimeShippingAddressParams{
            FirstName : "John",
            LastName : "Mathew",
            City : "Walnut",
            State : "California",
            Zip : "91789",
            Country : "US",
        },
    }).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)
  req := &chargebee.HostedPageCheckoutOneTimeRequest{
    Addons : []*chargebee.HostedPageCheckoutOneTimeAddon{
        {
            Id : "non_recurring_addon",
            UnitPrice : chargebee.Int64(2000),
            Quantity : chargebee.Int32(2),
        },
    },
    Customer : &chargebee.HostedPageCheckoutOneTimeCustomer{
        Id : "__test__3Nl7Oe7SJWjx905b",
    },
    BillingAddress : &chargebee.HostedPageCheckoutOneTimeBillingAddress{
        FirstName : "John",
        LastName : "Doe",
        Line1 : "PO Box 9999",
        City : "Walnut",
        State : "California",
        Zip : "91789",
        Country : "US",
    },
    ShippingAddress : &chargebee.HostedPageCheckoutOneTimeShippingAddress{
        FirstName : "John",
        LastName : "Mathew",
        City : "Walnut",
        State : "California",
        Zip : "91789",
        Country : "US",
    },
}
  res, err := client.HostedPage.CheckoutOneTime(req)
      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.checkoutOneTime()
            .customerId("__test__3Nl7Oe7SJWjx905b")
            .addonId(0, "non_recurring_addon")
            .addonUnitPrice(0, 2000L)
            .addonQuantity(0, 2)
            .billingAddressFirstName("John")
            .billingAddressLastName("Doe")
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressState("California")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .shippingAddressFirstName("John")
            .shippingAddressLastName("Mathew")
            .shippingAddressCity("Walnut")
            .shippingAddressState("California")
            .shippingAddressZip("91789")
            .shippingAddressCountry("US")
            .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.HostedPageCheckoutOneTimeParams;
import com.chargebee.v4.models.hostedPage.responses.HostedPageCheckoutOneTimeResponse;
import java.util.List;

public class HostedPageCheckoutOneTime {

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

        HostedPageCheckoutOneTimeParams.CustomerParams customerParams =
            HostedPageCheckoutOneTimeParams.CustomerParams.builder()
                .id("__test__3Nl7Oe7SJWjx905b")
                .build();

        HostedPageCheckoutOneTimeParams.BillingAddressParams billingAddressParams =
            HostedPageCheckoutOneTimeParams.BillingAddressParams.builder()
                .firstName("John")
                .lastName("Doe")
                .line1("PO Box 9999")
                .city("Walnut")
                .state("California")
                .zip("91789")
                .country("US")
                .build();

        HostedPageCheckoutOneTimeParams.ShippingAddressParams shippingAddressParams =
            HostedPageCheckoutOneTimeParams.ShippingAddressParams.builder()
                .firstName("John")
                .lastName("Mathew")
                .city("Walnut")
                .state("California")
                .zip("91789")
                .country("US")
                .build();

        HostedPageCheckoutOneTimeParams.AddonsParams addon0 =
            HostedPageCheckoutOneTimeParams.AddonsParams.builder()
                .id("non_recurring_addon")
                .unitPrice(2000L)
                .quantity(2)
                .build();

        List<HostedPageCheckoutOneTimeParams.AddonsParams> addonsList =
            List.of(addon0);

        HostedPageCheckoutOneTimeParams params = HostedPageCheckoutOneTimeParams.builder()
            .customer(customerParams)
            .addons(addonsList)
            .billingAddress(billingAddressParams)
            .shippingAddress(shippingAddressParams)
            .build();

        HostedPageCheckoutOneTimeResponse response = client.hostedPages().checkoutOneTime(params);

        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.checkoutOneTime({
        addons: [
            {
                id: "non_recurring_addon",
                unit_price: 2000,
                quantity: 2
            }
        ],
        customer: {
            id: "__test__3Nl7Oe7SJWjx905b"
        },
        billing_address: {
            first_name: "John",
            last_name: "Doe",
            line1: "PO Box 9999",
            city: "Walnut",
            state: "California",
            zip: 91789,
            country: "US"
        },
        shipping_address: {
            first_name: "John",
            last_name: "Mathew",
            city: "Walnut",
            state: "California",
            zip: 91789,
            country: "US"
        }
    });

    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()->checkoutOneTime([
    "addons" => [
        [
            "id" => "non_recurring_addon",
            "unit_price" => 2000,
            "quantity" => 2
        ]
    ],
    "customer" => [
        "id" => "__test__3Nl7Oe7SJWjx905b"
    ],
    "billing_address" => [
        "first_name" => "John",
        "last_name" => "Doe",
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "state" => "California",
        "zip" => "91789",
        "country" => "US"
    ],
    "shipping_address" => [
        "first_name" => "John",
        "last_name" => "Mathew",
        "city" => "Walnut",
        "state" => "California",
        "zip" => "91789",
        "country" => "US"
    ]
]);
$hostedPage = $result->hosted_page;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.HostedPage.checkout_one_time(
    cb_client.HostedPage.CheckoutOneTimeParams(
        addons=[
            cb_client.HostedPage.CheckoutOneTimeAddonParams(
              id="non_recurring_addon",
              unit_price=2000,
              quantity=2
            )
        ],
        customer=cb_client.HostedPage.CheckoutOneTimeCustomerParams(
            id="__test__3Nl7Oe7SJWjx905b"
        ),
        billing_address=cb_client.HostedPage.CheckoutOneTimeBillingAddressParams(
            first_name="John",
            last_name="Doe",
            line1="PO Box 9999",
            city="Walnut",
            state="California",
            zip="91789",
            country="US"
        ),
        shipping_address=cb_client.HostedPage.CheckoutOneTimeShippingAddressParams(
            first_name="John",
            last_name="Mathew",
            city="Walnut",
            state="California",
            zip="91789",
            country="US"
        )
    )
)
hosted_page = response.hosted_page
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::HostedPage.checkout_one_time({
  :customer => {
    :id => "__test__3Nl7Oe7SJWjx905b"
  },
  :addons => [
    {
      :id => "non_recurring_addon",
      :unit_price => 2000,
      :quantity => 2
    }
  ],
  :billing_address => {
    :first_name => "John",
    :last_name => "Doe",
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :state => "California",
    :zip => "91789",
    :country => "US"
  },
  :shipping_address => {
    :first_name => "John",
    :last_name => "Mathew",
    :city => "Walnut",
    :state => "California",
    :zip => "91789",
    :country => "US"
  }
})

hosted_page = result.hosted_page
```

### Creates a checkout with one-time charge

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
     -u {site_api_key}:\
     -d "customer[id]"="__test__3Nl7Oe7SJWjxt75r" \
     -d "charges[amount][0]"=1000 \
     -d "charges[description][0]"="Support Charge"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = HostedPage.CheckoutOneTime()
		.CustomerId("__test__3Nl7Oe7SJWjxt75r")
		.ChargeAmount(0, 1000)
		.ChargeDescription(0, "Support Charge")
		.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"
    "github.com/chargebee/chargebee-go/v3/models/hostedpage"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := hostedpageAction.CheckoutOneTime(&hostedpage.CheckoutOneTimeRequestParams{
        Charges : []*hostedpage.CheckoutOneTimeChargeParams{
            {
                Amount : chargebee.Int64(1000),
                Description : "Support Charge",
            },
        },
        Customer : &hostedpage.CheckoutOneTimeCustomerParams{
            Id : "__test__3Nl7Oe7SJWjxt75r",
        },
    }).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)
  req := &chargebee.HostedPageCheckoutOneTimeRequest{
    Charges : []*chargebee.HostedPageCheckoutOneTimeCharge{
        {
            Amount : chargebee.Int64(1000),
            Description : "Support Charge",
        },
    },
    Customer : &chargebee.HostedPageCheckoutOneTimeCustomer{
        Id : "__test__3Nl7Oe7SJWjxt75r",
    },
}
  res, err := client.HostedPage.CheckoutOneTime(req)
      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.checkoutOneTime()
            .customerId("__test__3Nl7Oe7SJWjxt75r")
            .chargeAmount(0, 1000L)
            .chargeDescription(0, "Support Charge")
            .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.HostedPageCheckoutOneTimeParams;
import com.chargebee.v4.models.hostedPage.responses.HostedPageCheckoutOneTimeResponse;
import java.util.List;

public class HostedPageCheckoutOneTime {

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

        HostedPageCheckoutOneTimeParams.CustomerParams customerParams =
            HostedPageCheckoutOneTimeParams.CustomerParams.builder()
                .id("__test__3Nl7Oe7SJWjxt75r")
                .build();

        HostedPageCheckoutOneTimeParams.ChargesParams charge0 =
            HostedPageCheckoutOneTimeParams.ChargesParams.builder()
                .amount(1000L)
                .description("Support Charge")
                .build();

        List<HostedPageCheckoutOneTimeParams.ChargesParams> chargesList =
            List.of(charge0);

        HostedPageCheckoutOneTimeParams params = HostedPageCheckoutOneTimeParams.builder()
            .customer(customerParams)
            .charges(chargesList)
            .build();

        HostedPageCheckoutOneTimeResponse response = client.hostedPages().checkoutOneTime(params);

        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.checkoutOneTime({
        charges: [
            {
                amount: 1000,
                description: "Support Charge"
            }
        ],
        customer: {
            id: "__test__3Nl7Oe7SJWjxt75r"
        }
    });

    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()->checkoutOneTime([
    "charges" => [
        [
            "amount" => 1000,
            "description" => "Support Charge"
        ]
    ],
    "customer" => [
        "id" => "__test__3Nl7Oe7SJWjxt75r"
    ]
]);
$hostedPage = $result->hosted_page;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.HostedPage.checkout_one_time(
    cb_client.HostedPage.CheckoutOneTimeParams(
        charges=[
            cb_client.HostedPage.CheckoutOneTimeChargeParams(
              amount=1000,
              description="Support Charge"
            )
        ],
        customer=cb_client.HostedPage.CheckoutOneTimeCustomerParams(
            id="__test__3Nl7Oe7SJWjxt75r"
        )
    )
)
hosted_page = response.hosted_page
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::HostedPage.checkout_one_time({
  :customer => {
    :id => "__test__3Nl7Oe7SJWjxt75r"
  },
  :charges => [
    {
      :amount => 1000,
      :description => "Support Charge"
    }
  ]
})

hosted_page = result.hosted_page
```

### Creates a checkout with non-recurring addon and one-time charge

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
     -u {site_api_key}:\
     -d "customer[id]"="__test__3Nl7Oe7SJWjxX15j" \
     -d "addons[id][0]"="non_recurring_addon" \
     -d "addons[unit_price][0]"=2000 \
     -d "addons[quantity][0]"=2 \
     -d "charges[amount][0]"=1000 \
     -d "charges[description][0]"="Support Charge"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = HostedPage.CheckoutOneTime()
		.CustomerId("__test__3Nl7Oe7SJWjxX15j")
		.AddonId(0, "non_recurring_addon")
		.AddonUnitPrice(0, 2000)
		.AddonQuantity(0, 2)
		.ChargeAmount(0, 1000)
		.ChargeDescription(0, "Support Charge")
		.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"
    "github.com/chargebee/chargebee-go/v3/models/hostedpage"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := hostedpageAction.CheckoutOneTime(&hostedpage.CheckoutOneTimeRequestParams{
        Addons : []*hostedpage.CheckoutOneTimeAddonParams{
            {
                Id : "non_recurring_addon",
                UnitPrice : chargebee.Int64(2000),
                Quantity : chargebee.Int32(2),
            },
        },
        Charges : []*hostedpage.CheckoutOneTimeChargeParams{
            {
                Amount : chargebee.Int64(1000),
                Description : "Support Charge",
            },
        },
        Customer : &hostedpage.CheckoutOneTimeCustomerParams{
            Id : "__test__3Nl7Oe7SJWjxX15j",
        },
    }).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)
  req := &chargebee.HostedPageCheckoutOneTimeRequest{
    Addons : []*chargebee.HostedPageCheckoutOneTimeAddon{
        {
            Id : "non_recurring_addon",
            UnitPrice : chargebee.Int64(2000),
            Quantity : chargebee.Int32(2),
        },
    },
    Charges : []*chargebee.HostedPageCheckoutOneTimeCharge{
        {
            Amount : chargebee.Int64(1000),
            Description : "Support Charge",
        },
    },
    Customer : &chargebee.HostedPageCheckoutOneTimeCustomer{
        Id : "__test__3Nl7Oe7SJWjxX15j",
    },
}
  res, err := client.HostedPage.CheckoutOneTime(req)
      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.checkoutOneTime()
            .customerId("__test__3Nl7Oe7SJWjxX15j")
            .addonId(0, "non_recurring_addon")
            .addonUnitPrice(0, 2000L)
            .addonQuantity(0, 2)
            .chargeAmount(0, 1000L)
            .chargeDescription(0, "Support Charge")
            .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.HostedPageCheckoutOneTimeParams;
import com.chargebee.v4.models.hostedPage.responses.HostedPageCheckoutOneTimeResponse;
import java.util.List;

public class HostedPageCheckoutOneTime {

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

        HostedPageCheckoutOneTimeParams.CustomerParams customerParams =
            HostedPageCheckoutOneTimeParams.CustomerParams.builder()
                .id("__test__3Nl7Oe7SJWjxX15j")
                .build();

        HostedPageCheckoutOneTimeParams.AddonsParams addon0 =
            HostedPageCheckoutOneTimeParams.AddonsParams.builder()
                .id("non_recurring_addon")
                .unitPrice(2000L)
                .quantity(2)
                .build();

        List<HostedPageCheckoutOneTimeParams.AddonsParams> addonsList =
            List.of(addon0);

        HostedPageCheckoutOneTimeParams.ChargesParams charge0 =
            HostedPageCheckoutOneTimeParams.ChargesParams.builder()
                .amount(1000L)
                .description("Support Charge")
                .build();

        List<HostedPageCheckoutOneTimeParams.ChargesParams> chargesList =
            List.of(charge0);

        HostedPageCheckoutOneTimeParams params = HostedPageCheckoutOneTimeParams.builder()
            .customer(customerParams)
            .addons(addonsList)
            .charges(chargesList)
            .build();

        HostedPageCheckoutOneTimeResponse response = client.hostedPages().checkoutOneTime(params);

        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.checkoutOneTime({
        addons: [
            {
                id: "non_recurring_addon",
                unit_price: 2000,
                quantity: 2
            }
        ],
        charges: [
            {
                amount: 1000,
                description: "Support Charge"
            }
        ],
        customer: {
            id: "__test__3Nl7Oe7SJWjxX15j"
        }
    });

    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()->checkoutOneTime([
    "addons" => [
        [
            "id" => "non_recurring_addon",
            "unit_price" => 2000,
            "quantity" => 2
        ]
    ],
    "charges" => [
        [
            "amount" => 1000,
            "description" => "Support Charge"
        ]
    ],
    "customer" => [
        "id" => "__test__3Nl7Oe7SJWjxX15j"
    ]
]);
$hostedPage = $result->hosted_page;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.HostedPage.checkout_one_time(
    cb_client.HostedPage.CheckoutOneTimeParams(
        addons=[
            cb_client.HostedPage.CheckoutOneTimeAddonParams(
              id="non_recurring_addon",
              unit_price=2000,
              quantity=2
            )
        ],
        charges=[
            cb_client.HostedPage.CheckoutOneTimeChargeParams(
              amount=1000,
              description="Support Charge"
            )
        ],
        customer=cb_client.HostedPage.CheckoutOneTimeCustomerParams(
            id="__test__3Nl7Oe7SJWjxX15j"
        )
    )
)
hosted_page = response.hosted_page
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::HostedPage.checkout_one_time({
  :customer => {
    :id => "__test__3Nl7Oe7SJWjxX15j"
  },
  :addons => [
    {
      :id => "non_recurring_addon",
      :unit_price => 2000,
      :quantity => 2
    }
  ],
  :charges => [
    {
      :amount => 1000,
      :description => "Support Charge"
    }
  ]
})

hosted_page = result.hosted_page
```

## Sample Response

```json
{
  "hosted_page": {
    "created_at": 1517490515,
    "embed": false,
    "expires_at": 1517494115,
    "id": "__one_time_checkout___test__ndXKBDiEMD5gWNAHT2FC8FpfdWjRJ60c",
    "layout": "in_app",
    "object": "hosted_page",
    "resource_version": 1517490515264,
    "state": "created",
    "type": "checkout_one_time",
    "updated_at": 1517490515,
    "url": "https://yourapp.chargebee.com/pages/v4/__one_time_checkout___test__ndXKBDiEMD5gWNAHT2FC8FpfdWjRJ60c/"
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/hosted_pages/checkout_one_time

## Input Parameters

- `currency_code` (required if Multicurrency is enabled, string, max chars=3)
  The currency code (ISO 4217 format) of the invoice amount.

- `invoice_note` (optional, string, max chars=2000)
  A note for this particular invoice. This, and [all other notes](/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer.

- `coupon_ids` (optional, string, max chars=100)
  Identifier of the coupon as a List. Coupon Codes can also be passed.

- `redirect_url` (optional, string, max chars=250)
  The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
  
  **Note** :
  
  -   Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](/docs/api/events) or [`invoice_generated`](/docs/api/events) to verify a successful checkout.
  -   Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
  -   _Eg :_ _http://yoursite.com?id=\*\*&state=succeeded_
  -   This parameter is not applicable for iframe messaging.

- `cancel_url` (optional, string, max chars=250)
  The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL.
  
  **Note** : - Cancel URL configured in Settings > Hosted Pages Settings would be overriden by this cancel URL.  
  _Eg : http://yoursite.com?id=&state=cancelled_
  
  -   This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout.

- `pass_thru_content` (optional, string, max chars=2048)
  This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](/docs/api/v2/pcv-1/hosted_pages/checkout-one-time-payments)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign.

- `embed` (optional, boolean, default=true)
  If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
  
  **Note** : For [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout, default is false.

- `iframe_messaging` (optional, boolean, default=false)
  If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe\_messaging you need to implement onSuccess & onCancel callbacks.
  
  **Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout.

- `customer` (optional, string)
  Parameters for customer
  - `id` (optional, string, max chars=50)
    The unique ID of the customer for which this `hosted_page` should be created. When not provided, a new customer is created with the ID set to the value provided for `subscription[id]`. If `subscription[id]` is unavailable, then the customer ID is autogenerated.
  - `email` (optional, string, max chars=70)
    Email of the customer. Configured email notifications will be sent to this email.
  - `first_name` (optional, string, max chars=150)
    First name of the customer. If not provided it will be got from contact information entered in the hosted page
  - `last_name` (optional, string, max chars=150)
    Last name of the customer. If not provided it will be got from contact information entered in the hosted page
  - `company` (optional, string, max chars=250)
    Company name of the customer.
  - `phone` (optional, string, max chars=50)
    Phone number of the customer
  - `locale` (optional, string, max chars=50)
    Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.
  - `taxability` (optional, enumerated string, default=taxable)
    Specifies if the customer is liable for tax
    Possible enum values:
      - `taxable`
        Computes tax for the customer based on the [site configuration](https://www.chargebee.com/docs/tax.html). In some cases, depending on the region, shipping\_address is needed. If not provided, then billing\_address is used to compute tax. If that's not available either, the tax is taken as zero.
      - `exempt`
        -   Customer is exempted from tax. When using Chargebee's native [Taxes](https://www.chargebee.com/docs/tax.html) feature or when using the [TaxJar integration](https://www.chargebee.com/docs/taxjar.html), no other action is needed.
        -   However, when using our [Avalara integration](https://www.chargebee.com/docs/avalara.html), optionally, specify `entity_code` or `exempt_number` attributes if you use Chargebee's [AvaTax for Sales](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) or specify `exemption_details` attribute if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. Tax may still be applied by Avalara for certain values of `entity_code`/`exempt_number`/`exemption_details` based on the state/region/province of the taxable address.
  - `vat_number` (optional, string, max chars=20)
    The VAT/tax registration number for the customer. For customers with `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting `[vat_number_prefix](/docs/api/customers/customer-object#vat_number_prefix)` .
  - `vat_number_prefix` (optional, string, max chars=10)
    An overridden value for the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI` (which is **United Kingdom - Northern Ireland** ).
    
    When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI`. That's the code for **United Kingdom - Northern Ireland**. The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases.
  - `consolidated_invoicing` (optional, boolean)
    Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled.
    
    **Note:**
    
    Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [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) to enable consolidation for such invoices.

- `invoice` (optional, string)
  Parameters for invoice
  - `po_number` (optional, string, max chars=100)
    Purchase Order Number for this invoice.

- `card` (optional, string)
  Parameters for card
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which this payment source is stored.

- `billing_address` (optional, string)
  Parameters for billing\_address
  - `first_name` (optional, string, max chars=150)
    The first name of the billing contact.
  - `last_name` (optional, string, max chars=150)
    The last name of the billing contact.
  - `email` (optional, string, max chars=70)
    The email address.
  - `company` (optional, string, max chars=250)
    The company name.
  - `phone` (optional, string, max chars=50)
    The phone number.
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. For instance, for Arizona (USA), set `state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ). For Dubai (UAE), set as `DU` (not `AE-DU` ).
  - `state` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `state_code` is provided.
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

- `shipping_address` (optional, string)
  Parameters for shipping\_address
  - `first_name` (optional, string, max chars=150)
    The first name of the contact.
  - `last_name` (optional, string, max chars=150)
    The last name of the contact.
  - `email` (optional, string, max chars=70)
    The email address.
  - `company` (optional, string, max chars=250)
    The company name.
  - `phone` (optional, string, max chars=50)
    The phone number.
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. For instance, for Arizona (USA), set `state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ). For Dubai (UAE), set as `DU` (not `AE-DU` ).
  - `state` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `state_code` is provided.
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

- `addons` (optional, array)
  Parameters for addons
  - `id` (optional, string, max chars=100)
    Unique ID of the [addon](/docs/api/v2/pcv-1/addons/addon-object) to be added to the invoice.
    
    **Constraints**  
    The addon must have [`charge_type`](/docs/api/v2/pcv-1/addons#charge_type) set to `charge`.
  - `quantity` (optional, integer)
    Quantity of the addon. Applicable for addons with `pricing_model` other than `flat_fee` .
  - `unit_price` (optional, in cents)
    The price or per-unit price of the non-recurring addon. By default, the [value set](/docs/api/v2/pcv-1/addons/addon-object#price) for the addon is used. The value depends on the [type of currency](/docs/api/v2/pcv-1/currencies#currency-values).
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the [non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon ). Provide the value in major units of the currency. Must be provided when the addon is quantity-based. This parameter can only be passed when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    When [price overriding](http://chargebee.com/docs/price-override.html ) is enabled for the site, the price or per-unit price of the [non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon ) can be set here. The value [set for the addon](/docs/api/v2/pcv-1/addons/addon-object#price) is used by default. Provide the value as a decimal string in major units of the currency. This parameter can only be passed when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `date_from` (optional, timestamp(UTC) in seconds)
    The time when the service period for the addon starts.
  - `date_to` (optional, timestamp(UTC) in seconds)
    The time when the service period for the addon ends.

- `charges` (optional, array)
  Parameters for charges
  - `amount` (optional, in cents)
    The amount to be charged. The unit depends on the [type of currency](/docs/api/getting-started) .
  - `amount_in_decimal` (optional, string, max chars=39)
    The decimal representation of the amount for the [one-time charge](https://www.chargebee.com/docs/charges.html#one-time-charges ). Provide the value in major units of the currency. Can be provided only when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `description` (optional, string, max chars=250)
    Description for this charge
  - `taxable` (optional, boolean)
    The amount to be charged is taxable or not.
  - `tax_profile_id` (optional, string, max chars=50)
    Tax profile of the charge.
  - `avalara_tax_code` (optional, string, max chars=50)
    The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html) .
  - `hsn_code` (optional, string, max chars=50)
    The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true:
    
    -   [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.)
    -   The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee.
  - `taxjar_product_code` (optional, string, max chars=50)
    The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) .
  - `avalara_sale_type` (optional, enumerated string)
    Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
    Possible enum values:
      - `wholesale`
        Transaction is a sale to another company that will resell your product or service to another consumer
      - `retail`
        Transaction is a sale to an end user
      - `consumed`
        Transaction is for an item that is consumed directly
      - `vendor_use`
        Transaction is for an item that is subject to vendor use tax
  - `avalara_transaction_type` (optional, integer)
    Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
  - `avalara_service_type` (optional, integer)
    Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
  - `date_from` (optional, timestamp(UTC) in seconds)
    The time when the service period for the charge starts.
  - `date_to` (optional, timestamp(UTC) in seconds)
    The time when the service period for the charge ends.

## Returns

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