# Source: https://docs.stripe.com/invoicing/scheduled-finalization.md

# Schedule invoice finalization to send or charge an invoice in the future

Learn how to schedule an invoice and automatically send or charge for it on a  future date.

You can create an invoice on Stripe today and [finalize](https://docs.stripe.com/invoicing/integration/workflow-transitions.md) or charge for it on a future date.

> When you use a custom finalization time for invoices, finalization won’t be delayed because of `invoice.created` webhook failures. This is different from the behavior described in the [Webhooks and invoices](https://docs.stripe.com/billing/subscriptions/webhooks.md#understand) guidance.

## Before you begin 

To configure an automatic finalization time for an invoice, you must have [automatic invoice advancement](https://docs.stripe.com/invoicing/integration/automatic-advancement-collection.md) enabled for the invoice. Dashboard scheduled invoices have this enabled automatically. You can automatically finalize an invoice up to 5 years in the future. If you don’t pass in a value for `automatically_finalizes_at` when enabling automatic invoice advancement in the API, Stripe calculates and sets the time according to the [configurable grace period](https://docs.stripe.com/billing/subscriptions/usage-based/configure-grace-period.md) you currently have set. Turning off automatic advancement disables the invoice from being automatically charged or sent. Learn more about this in [Pause invoice advancement](https://docs.stripe.com/invoicing/integration/automatic-advancement-collection.md#pausing-auto-collection).

## Schedule a one-off invoice to finalize in the future 

#### Dashboard

For a draft invoice that you want to send for payment, you can specify a date in the future to either finalize the invoice or finalize and send it.

1. After you complete your invoice details, click **Review**. You’ll see an option to **Finalize and send** or **Finalize only**.

1. If you’re sending the invoice to your buyer, you can toggle **Schedule send date** and pick a date in the future. If you only need to finalize the invoice without sending it automatically, you can toggle **Schedule finalization date**. After making your selection, click **Schedule invoice**.

1. Your invoice is now scheduled, and you can can edit the draft or cancel it. Click **Edit draft** to edit it, or click **Unschedule** to cancel the scheduled finalization.

For invoices where you charge the buyer automatically, the option to **Schedule charge date** is in the invoice editor.

#### API

> For a complete guide on how to get started using the [Stripe CLI](https://docs.stripe.com/stripe-cli.md) or API, see the [Invoicing end-to-end integration guide](https://docs.stripe.com/invoicing/integration.md).

For a draft invoice, specify the time that you want the invoice to be finalized. If `auto_advance` isn’t already enabled for the invoice, you have to enable it.

```curl
curl https://api.stripe.com/v1/invoices \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d automatically_finalizes_at=1748799295
```

```cli
stripe invoices create  \
  --automatically-finalizes-at=1748799295
```

```ruby
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
client = Stripe::StripeClient.new("<<YOUR_SECRET_KEY>>")

invoice = client.v1.invoices.create({automatically_finalizes_at: 1748799295})
```

```python
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
client = StripeClient("<<YOUR_SECRET_KEY>>")

# For SDK versions 12.4.0 or lower, remove '.v1' from the following line.
invoice = client.v1.invoices.create({"automatically_finalizes_at": 1748799295})
```

```php
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
$stripe = new \Stripe\StripeClient('<<YOUR_SECRET_KEY>>');

$invoice = $stripe->invoices->create(['automatically_finalizes_at' => 1748799295]);
```

```java
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
StripeClient client = new StripeClient("<<YOUR_SECRET_KEY>>");

InvoiceCreateParams params =
  InvoiceCreateParams.builder().setAutomaticallyFinalizesAt(1748799295L).build();

// For SDK versions 29.4.0 or lower, remove '.v1()' from the following line.
Invoice invoice = client.v1().invoices().create(params);
```

```node
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('<<YOUR_SECRET_KEY>>');

const invoice = await stripe.invoices.create({
  automatically_finalizes_at: 1748799295,
});
```

```go
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
sc := stripe.NewClient("<<YOUR_SECRET_KEY>>")
params := &stripe.InvoiceCreateParams{AutomaticallyFinalizesAt: stripe.Int64(1748799295)}
result, err := sc.V1Invoices.Create(context.TODO(), params)
```

```dotnet
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
var options = new InvoiceCreateOptions();
options.AddExtraParam("automatically_finalizes_at", 1748799295);
var client = new StripeClient("<<YOUR_SECRET_KEY>>");
var service = client.V1.Invoices;
Invoice invoice = service.Create(options);
```

## Viewing scheduled invoices 

You can view scheduled invoices in the Dashboard in a few ways:

- Filter invoices for whether or not they have scheduled invoice finalization enabled, based on the `Scheduled finalization date` column and `Scheduled finalization date` filter on the [Invoices](https://dashboard.stripe.com/invoices) page.

- In the **Details** section of a page for a specific invoice, the `Finalizes at` property indicates when that invoice is scheduled to be finalized.

## Subscription invoice usage 

Invoices generated by subscriptions are already scheduled for finalization upon invoice creation, based on the [configurable grace period](https://docs.stripe.com/billing/subscriptions/usage-based/configure-grace-period.md) you currently have set. Turning off automatic advancement disables the invoice from being automatically charged or sent to the user. Learn how to [pause invoice advancement](https://docs.stripe.com/invoicing/integration/automatic-advancement-collection.md#pausing-auto-collection) for any you have set. You can modify these invoices using the process described here, but make sure you consider the following:

- Non-finalized invoices remain in a draft state. This means that pushing this scheduled finalization date out further potentially increases the time that customers could have an active subscription without having an invoice be sent or charged to them.
- Modifying this time won’t cause invoice finalization to be delayed based on failure to respond to `invoice.created` webhooks. If you want to depend on webhook failures delaying invoice finalization, don’t modify this `automatically_finalizes_at` field.

## Common pitfalls 

This feature has some common pitfalls to be aware of:

- If the invoice has `automatic_tax[enabled]=true` but the customer doesn’t have sufficient tax information, automatic finalization fails. Learn more about [invoice finalization errors](https://docs.stripe.com/tax/customer-locations.md#finalizing-invoices-with-finalization-failures) and how to resolve this issue.
- The **Send finalized invoices and credit notes to customers** setting must be enabled in [Subscriptions and emails settings](https://dashboard.stripe.com/settings/billing/automatic) if you want emails for automatically finalized invoices to send to customers.
  - This ability of sending emails for automatically finalized invoices is only available in live mode.