# Remove an advance invoice schedule

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


[Idempotency Supported](/docs/api/idempotency)

**Caution**

-   This API will return an error when [multi-frequency billing](/docs/api/subscriptions#subscription-billing-frequencies) is enabled.

Deletes an advance invoicing schedule. When _schedule\_type = specific\_dates_, you also have the option of deleting a part of the schedule.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/subscriptions/__test__XpbBsG2SYV7ZMB2K/remove_advance_invoice_schedule \
     -X POST  \
     -u {site_api_key}:
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Subscription.RemoveAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K").Request();

Subscription subscription = result.Subscription;
List<AdvanceInvoiceSchedule> advanceInvoiceSchedules = result.AdvanceInvoiceSchedules;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := subscriptionAction.RemoveAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K", nil).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        AdvanceInvoiceSchedules := res.AdvanceInvoiceSchedules
    }
}
```

#### 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.SubscriptionRemoveAdvanceInvoiceScheduleRequest{}
  res, err := client.Subscription.RemoveAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        AdvanceInvoiceSchedules := res.AdvanceInvoiceSchedules
    }
}
```

#### Java

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

public class Sample {

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

        Subscription subscription = result.subscription();
        List<AdvanceInvoiceSchedule> advanceInvoiceSchedules = result.advanceInvoiceSchedules();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule;
import com.chargebee.v4.models.subscription.Subscription;
import com.chargebee.v4.models.subscription.params.SubscriptionRemoveAdvanceInvoiceScheduleParams;
import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveAdvanceInvoiceScheduleResponse;
import java.util.List;

public class SubscriptionRemoveAdvanceInvoiceSchedule {

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

        SubscriptionRemoveAdvanceInvoiceScheduleResponse response = client.subscriptions().removeAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K");

        Subscription subscription = response.getSubscription();
        List<AdvanceInvoiceSchedule> advanceInvoiceSchedules = response.getAdvanceInvoiceSchedules();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.subscription.removeAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K");

    console.log(result);
    const subscription = result.subscription;
    const advanceInvoiceSchedules = result.advance_invoice_schedules;
} 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->subscription()->removeAdvanceInvoiceSchedule("__test__XpbBsG2SYV7ZMB2K");
$subscription = $result->subscription;
$advanceInvoiceSchedules = $result->advance_invoice_schedules;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Subscription.remove_advance_invoice_schedule("__test__XpbBsG2SYV7ZMB2K")
subscription = response.subscription
advance_invoice_schedules = response.advance_invoice_schedules
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Subscription.remove_advance_invoice_schedule("__test__XpbBsG2SYV7ZMB2K")

subscription = result.subscription
advance_invoice_schedules = result.advance_invoice_schedules
```

## Sample Response

```json
{
  "advance_invoice_schedules": {},
  "subscription": {
    "customer": {
      "allow_direct_debit": false,
      "auto_collection": "off",
      "card_status": "no_card",
      "created_at": 1622014982,
      "deleted": false,
      "excess_payments": 0,
      "first_name": "John",
      "id": "__test__XpbBsG2SYV7ZFJ2H",
      "last_name": "Doe",
      "net_term_days": 0,
      "object": "customer",
      "pii_cleared": "active",
      "preferred_currency_code": "USD",
      "promotional_credits": 0,
      "refundable_credits": 0,
      "resource_version": 1622014982000,
      "taxability": "taxable",
      "unbilled_charges": 0,
      "updated_at": 1622014982
    },
    "subscription": {
      "activated_at": 1622014983,
      "billing_period": 1,
      "billing_period_unit": "month",
      "created_at": 1622014983,
      "currency_code": "USD",
      "current_term_end": 1624693383,
      "current_term_start": 1622014983,
      "customer_id": "__test__XpbBsG2SYV7ZFJ2H",
      "deleted": false,
      "due_invoices_count": 1,
      "due_since": 1622014983,
      "has_scheduled_advance_invoices": false,
      "has_scheduled_changes": false,
      "id": "__test__XpbBsG2SYV7ZMB2K",
      "mrr": 0,
      "next_billing_at": 1624693383,
      "object": "subscription",
      "resource_version": 1622014983000,
      "started_at": 1622014983,
      "status": "active",
      "subscription_items": [
        {
          "amount": 1000,
          "free_quantity": 0,
          "item_price_id": "basic-USD",
          "item_type": "plan",
          "object": "subscription_item",
          "quantity": 1,
          "unit_price": 1000
        },
        {..}
      ],
      "total_dues": 1100,
      "updated_at": 1622014983
    }
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/subscriptions/{subscription-id}/remove_advance_invoice_schedule

## Input Parameters

- `specific_dates_schedule` (optional, array)
  Parameters for specific\_dates\_schedule
  - `id` (optional, string, max chars=50)
    When _schedule\_type = specific\_dates_ , pass the id of the [specific\_dates\_schedule](/docs/api/advance_invoice_schedules/advance_invoice_schedule-object#specific_dates_schedule) that you want to remove. If not passed, the entire advance\_invoice\_schedule is removed.

## Returns

- `subscription` (Subscription object)
  Resource object representing subscription

- `advance_invoice_schedules` (optional)
  Resource object representing advance\_invoice\_schedule
