# Create quote for one-time charges

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


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

Creates a quote for [one-time charges](https://www.chargebee.com/docs/charges.html#one-time-charges) and [non-recurring addons](https://www.chargebee.com/docs/charges.html#non-recurring-addon). This is applicable only for one-time payment. Recurring charges are not permitted in this quote; use [Create quote for a new subscription](/docs/api/v2/pcv-1/quotes/create-quote-for-a-new-subscription) or [Create quote for updating a subscription](/docs/api/v2/pcv-1/quotes/create-quote-for-updating-a-subscription) instead.

To send this quote, use "[Send Email](https://www.chargebee.com/docs/quotes.html#other-quote-actions_send-email)" quote action in the Chargebee application.

Based on the customer's reply, you can use [Update quote status](/docs/api/quotes/update-quote-status) and [Convert a quote](/docs/api/quotes/convert-a-quote) APIs for changing quote status and invoicing the customer, respectively.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/quotes/create_for_onetime_charges \
     -u {site_api_key}:\
     -d customer_id="__test__KyVnHhSBWTM5WB0" \
     -d "charges[amount][0]"=1000 \
     -d "charges[description][0]"="Service Charge"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Quote.CreateForOnetimeCharges()
		.CustomerId("__test__KyVnHhSBWTM5WB0")
		.ChargeAmount(0, 1000)
		.ChargeDescription(0, "Service Charge")
		.Request();

Quote quote = result.Quote;
QuotedCharge quotedCharge = result.QuotedCharge;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    quoteAction "github.com/chargebee/chargebee-go/v3/actions/quote"
    "github.com/chargebee/chargebee-go/v3/models/quote"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := quoteAction.CreateForOnetimeCharges(&quote.CreateForOnetimeChargesRequestParams{
        Charges : []*quote.CreateForOnetimeChargesChargeParams{
            {
                Amount : chargebee.Int64(1000),
                Description : "Service Charge",
            },
        },
        CustomerId : "__test__KyVnHhSBWTM5WB0",
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Quote := res.Quote
        QuotedCharge := res.QuotedCharge
    }
}
```

#### 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.QuoteCreateForOnetimeChargesRequest{
    Charges : []*chargebee.QuoteCreateForOnetimeChargesCharge{
        {
            Amount : chargebee.Int64(1000),
            Description : "Service Charge",
        },
    },
    CustomerId : "__test__KyVnHhSBWTM5WB0",
}
  res, err := client.Quote.CreateForOnetimeCharges(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Quote := res.Quote
        QuotedCharge := res.QuotedCharge
    }
}
```

#### 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 = Quote.createForOnetimeCharges()
            .customerId("__test__KyVnHhSBWTM5WB0")
            .chargeAmount(0, 1000L)
            .chargeDescription(0, "Service Charge")
            .request();

        Quote quote = result.quote();
        QuotedCharge quotedCharge = result.quotedCharge();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.quote.Quote;
import com.chargebee.v4.models.quote.params.QuoteCreateForOnetimeChargesParams;
import com.chargebee.v4.models.quote.responses.QuoteCreateForOnetimeChargesResponse;
import com.chargebee.v4.models.quotedCharge.QuotedCharge;
import java.util.List;

public class QuoteCreateForOnetimeCharges {

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

        QuoteCreateForOnetimeChargesParams.ChargesParams charge0 =
            QuoteCreateForOnetimeChargesParams.ChargesParams.builder()
                .amount(1000L)
                .description("Service Charge")
                .build();

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

        QuoteCreateForOnetimeChargesParams params = QuoteCreateForOnetimeChargesParams.builder()
            .customerId("__test__KyVnHhSBWTM5WB0")
            .charges(chargesList)
            .build();

        QuoteCreateForOnetimeChargesResponse response = client.quotes().createForOnetimeCharges(params);

        Quote quote = response.getQuote();
        QuotedCharge quotedCharge = response.getQuotedCharge();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.quote.createForOnetimeCharges({
        charges: [
            {
                amount: 1000,
                description: "Service Charge"
            }
        ],
        customer_id: "__test__KyVnHhSBWTM5WB0"
    });

    console.log(result);
    const quote = result.quote;
    const quotedCharge = result.quoted_charge;
} 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->quote()->createForOnetimeCharges([
    "charges" => [
        [
            "amount" => 1000,
            "description" => "Service Charge"
        ]
    ],
    "customer_id" => "__test__KyVnHhSBWTM5WB0"
]);
$quote = $result->quote;
$quotedCharge = $result->quoted_charge;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Quote.create_for_onetime_charges(
    cb_client.Quote.CreateForOnetimeChargesParams(
        charges=[
            cb_client.Quote.CreateForOnetimeChargesChargeParams(
              amount=1000,
              description="Service Charge"
            )
        ],
        customer_id="__test__KyVnHhSBWTM5WB0"
    )
)
quote = response.quote
quoted_charge = response.quoted_charge
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Quote.create_for_onetime_charges({
  :customer_id => "__test__KyVnHhSBWTM5WB0",
  :charges => [
    {
      :amount => 1000,
      :description => "Service Charge"
    }
  ]
})

quote = result.quote
quoted_charge = result.quoted_charge
```

## Sample Response

```json
{
  "quote": {
    "amount_due": 1000,
    "amount_paid": 0,
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "object": "billing_address",
      "validation_status": "not_validated"
    },
    "charge_on_acceptance": 1000,
    "credits_applied": 0,
    "currency_code": "USD",
    "customer_id": "__test__KyVnHhSBWTM5WB0",
    "date": 1517501496,
    "id": "3",
    "line_item_discounts": {},
    "line_item_taxes": {},
    "line_items": [
      {
        "amount": 1000,
        "customer_id": "__test__KyVnHhSBWTM5WB0",
        "date_from": 1517501496,
        "date_to": 1517501496,
        "description": "Service Charge",
        "discount_amount": 0,
        "entity_type": "adhoc",
        "id": "__test__KyVnHhSBWTM8HB9",
        "is_taxed": false,
        "item_level_discount_amount": 0,
        "object": "line_item",
        "pricing_model": "flat_fee",
        "quantity": 1,
        "tax_amount": 0,
        "unit_amount": 1000
      },
      {..}
    ],
    "object": "quote",
    "operation_type": "onetime_invoice",
    "price_type": "tax_exclusive",
    "resource_version": 1517501496000,
    "status": "open",
    "sub_total": 1000,
    "taxes": {},
    "total": 1000,
    "total_payable": 1000,
    "updated_at": 1517501496,
    "valid_till": 1517596199,
    "version": 1
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/quotes/create_for_onetime_charges

## Input Parameters

- `name` (optional, string, max chars=100)
  The quote name will be used as the pdf name of the quote.

- `customer_id` (required, string, max chars=50)
  Identifier of the customer for which the quote needs to be created.

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

- `notes` (optional, string, max chars=10000)
  Notes specific to this quote that you want customers to see on the quote PDF.

- `expires_at` (optional, timestamp(UTC) in seconds)
  Quotes will be valid till this date. After this quote will be marked as closed.

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

- `coupon` (optional, string, max chars=100)
  The 'One Time' coupon to be applied.

- `coupon_ids` (optional, string, max chars=100)
  List of Coupons to be added.

- `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)
    Identifier of the addon. Multiple addons can be passed.
  - `quantity` (optional, integer)
    Quantity of the addon. Applicable for addons with `pricing_model` other than `flat_fee` .
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the addon. Returned for quantity-based plans when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `unit_price` (optional, in cents)
    The price or per-unit-price of the addon. The value depends on the [type of currency](/docs/api/getting-started).
    
    **Note:**
    
    For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the [addon period](/docs/api/v2/pcv-1/addons/addon-object#period). For example, consider the following details:
    
    -   The `unit_price` provided is $10
    -   The addon billing period is 1 month.
    -   The plan billing period is 3 months.
    -   The addon is only billed for $10 on each subscription renewal.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    The decimal representation of the price or per-unit price of the addon. The value is in major units of the currency. Always returned when multi-decimal pricing is enabled.
    
    **Note:**
    
    For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
    
    -   The `unit_price_in_decimal` provided is $10.75
    -   The addon billing period is 1 month.
    -   The plan billing period is 3 months.
    -   The addon is only billed for $10.75 on each subscription renewal.
  - `service_period` (optional, integer)
    Specifies the service period of the addon in days. When the quote is converted, the `[invoice.line_item.date_from](/docs/api/invoices/invoice-object#line_items)` is set to current date/time and `[invoice.line_item.date_to](/docs/api/invoices/invoice-object#line_items)` is set to `service_period` days ahead of `[date_from](/docs/api/invoices/invoice-object#line_items)` .

- `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. The value is in [major units of the currency](/docs/api/getting-started). Applicable only when multi-decimal pricing is enabled.
  - `description` (optional, string, max chars=250)
    Description for this charge
  - `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.
  - `service_period` (optional, integer)
    Service period for charge

- `tax_providers_fields` (optional, array)
  Parameters for tax\_providers\_fields
  - `provider_name` (optional, string, max chars=50)
    Name of the tax provider currently supported.
  - `field_id` (optional, string, max chars=50)
    Field id of the attribute which tax vendor has provided while getting onboarded with us.
  - `field_value` (optional, string, max chars=50)
    The value of the corresponding tax field.

## Returns

- `quote` (Quote object)
  Resource object representing quote

- `quoted_charge` (Quoted charge object)
  Resource object representing quoted\_charge
