# Remove scheduled changes from a subscription

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


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

Removes a scheduled change from a subscription.

##### Review the changes before removing them[](#review-the-changes-before-removing-them)

To review the scheduled subscription change before removing it, call [Retrieve with scheduled changes](/docs/api/subscriptions/retrieve-with-scheduled-changes) **before** calling this API to retrieve the subscription resource with the scheduled change applied.

### Prerequisites & Constraints

-   The subscription's [`has_scheduled_changes`](/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute is `true`.
-   The subscription has exactly **one** scheduled change. If multiple [ramps](/docs/api/ramps) exist, the API returns an error.

### Impacts

**

Subscription

**

-   Removes the scheduled change.
-   Clears [`changes_scheduled_at`](/docs/api/subscriptions/subscription-object#changes_scheduled_at), if set.
-   Sets `has_scheduled_changes` to `false`.

**

Invoices

**

-   If any [advance invoices](/docs/api/invoices/invoice-object#has_advance_charges) account for the scheduled change, Chargebee creates [credit notes](/docs/api/credit_notes) against those invoices.

**

Credit Notes

**

-   Creates the following credit notes against any advance invoices that account for the scheduled change:
    -   `adjustment`: for `amount_to_collect` on the advance invoice.
    -   `refundable`: for the refundable amount on the advance invoice.

### Implementation Notes

Before you call this API, confirm the following:

-   The subscription's `has_scheduled_changes` attribute is `true`.
-   Exactly one scheduled change exists. To verify, call [List ramps](/docs/api/ramps/list-ramps) and filter by `subscription_id`. The response must include exactly one `ramp` object.

#### Related APIs

Retrieve with scheduled changes

List ramps

## Sample Request

#### cURL

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

#### .NET

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

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

Subscription subscription = result.Subscription;
Customer customer = result.Customer;
Card card = result.Card;
List<CreditNote> creditNotes = result.CreditNotes;
```

#### 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.RemoveScheduledChanges("__test__8asukSOXdyTgRH").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        Customer := res.Customer
        Card := res.Card
        CreditNotes := res.CreditNotes
    }
}
```

#### 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)
  
  res, err := client.Subscription.RemoveScheduledChanges("__test__8asukSOXdyTgRH")
      if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        Customer := res.Customer
        Card := res.Card
        CreditNotes := res.CreditNotes
    }
}
```

#### 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.removeScheduledChanges("__test__8asukSOXdyTgRH").request();

        Subscription subscription = result.subscription();
        Customer customer = result.customer();
        Card card = result.card();
        List<CreditNote> creditNotes = result.creditNotes();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.creditNote.CreditNote;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.subscription.Subscription;
import com.chargebee.v4.models.subscription.params.SubscriptionRemoveScheduledChangesParams;
import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveScheduledChangesResponse;
import java.util.List;

public class SubscriptionRemoveScheduledChanges {

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

        SubscriptionRemoveScheduledChangesResponse response = client.subscriptions().removeScheduledChanges("__test__8asukSOXdyTgRH");

        Subscription subscription = response.getSubscription();
        Customer customer = response.getCustomer();
        Card card = response.getCard();
        List<CreditNote> creditNotes = response.getCreditNotes();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.subscription.removeScheduledChanges("__test__8asukSOXdyTgRH");

    console.log(result);
    const subscription = result.subscription;
    const customer = result.customer;
    const card = result.card;
    const creditNotes = result.credit_notes;
} 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()->removeScheduledChanges("__test__8asukSOXdyTgRH");
$subscription = $result->subscription;
$customer = $result->customer;
$card = $result->card;
$creditNotes = $result->credit_notes;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Subscription.remove_scheduled_changes("__test__8asukSOXdyTgRH")
subscription = response.subscription
customer = response.customer
card = response.card
credit_notes = response.credit_notes
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Subscription.remove_scheduled_changes("__test__8asukSOXdyTgRH")

subscription = result.subscription
customer = result.customer
card = result.card
credit_notes = result.credit_notes
```

## Sample Response

```json
{
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "off",
    "card_status": "no_card",
    "created_at": 1612890930,
    "deleted": false,
    "excess_payments": 0,
    "first_name": "John",
    "id": "__test__8asukSOXdyOjRE",
    "last_name": "Doe",
    "net_term_days": 0,
    "object": "customer",
    "pii_cleared": "active",
    "preferred_currency_code": "USD",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1612890930000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1612890930
  },
  "subscription": {
    "activated_at": 1612890930,
    "billing_period": 1,
    "billing_period_unit": "month",
    "created_at": 1612890930,
    "currency_code": "USD",
    "current_term_end": 1615310130,
    "current_term_start": 1612890930,
    "customer_id": "__test__8asukSOXdyOjRE",
    "deleted": false,
    "due_invoices_count": 1,
    "due_since": 1612890930,
    "has_scheduled_changes": false,
    "id": "__test__8asukSOXdyTgRH",
    "mrr": 0,
    "next_billing_at": 1615310130,
    "object": "subscription",
    "remaining_billing_cycles": 1,
    "resource_version": 1612890932000,
    "started_at": 1612890930,
    "status": "active",
    "subscription_items": [
      {
        "amount": 1000,
        "billing_cycles": 1,
        "free_quantity": 0,
        "item_price_id": "basic-USD",
        "item_type": "plan",
        "object": "subscription_item",
        "quantity": 1,
        "unit_price": 1000
      },
      {..}
    ],
    "total_dues": 1100,
    "updated_at": 1612890932
  }
}
```

## URL Format

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

## Returns

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

- `customer` (Customer object)
  Resource object representing customer

- `card` (Card object)
  Resource object representing card

- `credit_notes` (optional)
  Resource object representing credit\_note
