# Create and send a quote Learn how to create, send, and accept a quote. > You can use quotes in a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes). To finalise, download, or accept quotes in live mode for one-off invoices through the API or Dashboard, you must upgrade to [Invoicing Plus](https://stripe.com/invoicing/pricing). See which plan [is right for you](https://support.stripe.com/questions/how-to-access-quotes). # API A quote is a way to show prospective or existing customers the costs for a set of products and services. Quotes show the cost of either a one-off *invoice* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice) or *subscription* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis). When a customer accepts the quote, ​​Stripe automatically creates all relevant invoices and subscriptions. ​​Many sales workflows use this common tool. ## Create a customer [Server-side] > #### Use the Accounts v2 API to represent customers > > The Accounts v2 API is generally available for Connect users, and in public preview for other Stripe users. If you’re part of the Accounts v2 preview, you need to specify a [specify a preview version](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) in your code. > > To request access to the Accounts v2 preview, > > For most use cases, we recommend [modelling your customers as customer-configured Account objects](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) instead of using [Customer](https://docs.stripe.com/api/customers.md) objects. To create a quote, you need an object that represents your customer (either a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/object.md#v2_account_object-configuration-customer) or a [Customer](https://docs.stripe.com/api/customers/object.md)) to attach to the quote. After you create a customer, store its ID in your database so you can use it later to create a quote. ## Create a quote [Server-side] To create a quote, pass in the [customer_account](https://docs.stripe.com/api/quotes/create.md#create_quote-customer_account) or [customer](https://docs.stripe.com/api/quotes/create.md#create_quote-customer) and [line_items](https://docs.stripe.com/api/quotes/create.md#create_quote-line_items). You can use prices to model the offerings that your business provides. Learn how to [set up your product catalogue](https://docs.stripe.com/products-prices/overview.md) to use prices with quotes. You can add each offering from your business to the quote as a line item by specifying the [price](https://docs.stripe.com/api/quotes/create.md#create_quote-line_items-price) and [quantity](https://docs.stripe.com/api/quotes/create.md#create_quote-line_items-quantity). For example, if you were to create a quote for a monthly software licence that comes with a one-off consultation fee to install the software, the quote would contain two line items: - The first line item represents five licenses of the 100 USD per month per license cost of the software. - The second line item represents the one-time 1000 USD consultation fee. A newly created quote has a `draft` status. You can modify draft quotes by adding or removing [line items](https://docs.stripe.com/api/quotes/update.md#update_quote-line_items). #### Accounts v2 ```curl curl https://api.stripe.com/v1/quotes \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "line_items[0][price]=price_CBb6IXqvTLXp3f" \ -d "line_items[0][quantity]=5" \ -d "line_items[1][price]=price_HGd7M3DV3IMXkC" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/quotes \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "line_items[0][price]=price_CBb6IXqvTLXp3f" \ -d "line_items[0][quantity]=5" \ -d "line_items[1][price]=price_HGd7M3DV3IMXkC" ``` ## Send a quote [Server-side] When you’re ready to send the quote to your customer, you can move it to an `open` state by [finalising the quote](https://docs.stripe.com/api/quotes/finalize.md). Because the quote is for a specific customer, you must attach a `Customer object` to it before it can transition to the new state. ```curl curl -X POST https://api.stripe.com/v1/quotes/qt_1HDGlYClCIKljWvsIGaAA06B/finalize \ -u "<>:" ``` After you finalize a quote, you can download the PDF, which contains an overview of the quote. Attach it to an email and send it to your customer. #### curl ```bash curl https://files.stripe.com/v1/quotes/qt_1HDGlYClCIKljWvsIGaAA06B/pdf \ -u <>: \ -G ``` You can also set a [header](https://docs.stripe.com/api/quotes/create.md#create_quote-header), [footer](https://docs.stripe.com/api/quotes/create.md#create_quote-footer) and [description](https://docs.stripe.com/api/quotes/create.md#create_quote-memo) on your quote, which the PDF displays. You can specify the default settings for the `header`, `footer` and `description` in the [Quote template](https://dashboard.stripe.com/settings/billing/quote). Remember to keep the quote in an `open` state while your customer reviews it. ## Mark a quote as accepted [Server-side] ​​After the customer agrees to the quote, move it to the `accepted` state, which automatically creates an invoice or subscription (depending on whether you’ve added line items with a recurring price). When you use a quote for one-off payments, Stripe creates an invoice in the `draft` state. You can make modifications to your invoice before [sending it to your customer](https://docs.stripe.com/invoicing/integration.md). ```curl curl -X POST https://api.stripe.com/v1/quotes/qt_1HDGlYClCIKljWvsIGaAA06B/accept \ -u "<>:" ``` ## Optional: Convert a quote to a subscription [Server-side] To create a subscription using a quote, you need to add at least one line item with a recurring price. ​​This ensures that the quote creates a subscription when it enters an `accept` state. If the [recurring](https://docs.stripe.com/api/quotes/object.md#quote_object-recurring) parameter on a quote isn’t `null`, then Stripe creates a subscription or subscription schedule after your customer accepts it. To customise the subscription, you can specify its configuration using [subscription_data](https://docs.stripe.com/api/quotes/create.md#create_quote-subscription_data). For example, you might want the subscription to have a trial period. Set [trial_period_days](https://docs.stripe.com/api/quotes/create.md#create_quote-subscription_data-trial_period_days) to specify how many days the trial lasts. ```curl curl https://api.stripe.com/v1/quotes/qt_1HDGlYClCIKljWvsIGaAA06B \ -u "<>:" \ -d "subscription_data[trial_period_days]=7" ``` You can collect your customer’s [payment details](https://docs.stripe.com/payments/save-and-reuse.md?platform=checkout) ahead of time. If your customer doesn’t have a default payment method on file, and you plan to automatically charge them, set the quote’s [collection_method](https://docs.stripe.com/api/quotes/create.md#create_quote-collection_method) to `charge_automatically`. Stripe creates an `active` subscription with the first invoice in a `draft` state set to `auto_advance=true`. We automatically finalize the invoice after 1 hour and the subscription status updates accordingly. ### Create a subscription schedule from a quote If you want your subscription to start in the future, create a [subscription schedule](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md). For example, you might want the subscription to start on the first day of the following month. Set the [effective_date](https://docs.stripe.com/api/quotes/create.md#create_quote-subscription_data-effective_date) to specify when the subscription schedule starts: ```curl curl https://api.stripe.com/v1/quotes/qt_1HDGlYClCIKljWvsIGaAA06B \ -u "<>:" \ -d "subscription_data[effective_date]=1641013200" ```