# Retrieve a subscription with scheduled changes

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


**Note** If the [`ramp`](/docs/api/ramps)s feature is enabled and there is more than one ramp on a subscription, this API will return the subscription with the upcoming ramp applied.

Retrieves a subscription with the scheduled changes applied.  
**Note:** Only the following attributes are changed

-   item\_id
-   item\_price\_id
-   billing\_period
-   billing\_period\_unit
-   remaining\_billing\_cycles
-   coupons Other attributes such as **status** ,**next\_billing\_at** are not changed and will reflect the current subscription values.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXe0ksSf/retrieve_with_scheduled_changes \
     -u {site_api_key}:
```

#### .NET

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

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

Subscription subscription = result.Subscription;
Customer customer = result.Customer;
Card card = result.Card;
```

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

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

#### 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 = Subscription.retrieveWithScheduledChanges("__test__8asukSOXe0ksSf").request();

        Subscription subscription = result.subscription();
        Customer customer = result.customer();
        Card card = result.card();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.subscription.Subscription;
import com.chargebee.v4.models.subscription.params.SubscriptionRetrieveWithScheduledChangesParams;
import com.chargebee.v4.models.subscription.responses.SubscriptionRetrieveWithScheduledChangesResponse;

public class SubscriptionRetrieveWithScheduledChanges {

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

        SubscriptionRetrieveWithScheduledChangesResponse response = client.subscriptions().retrieveWithScheduledChanges("__test__8asukSOXe0ksSf");

        Subscription subscription = response.getSubscription();
        Customer customer = response.getCustomer();
        Card card = response.getCard();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.subscription.retrieveWithScheduledChanges("__test__8asukSOXe0ksSf");

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

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Subscription.retrieve_with_scheduled_changes("__test__8asukSOXe0ksSf")
subscription = response.subscription
customer = response.customer
card = response.card
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Subscription.retrieve_with_scheduled_changes("__test__8asukSOXe0ksSf")

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

## Sample Response

```json
{
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "off",
    "card_status": "no_card",
    "created_at": 1612890939,
    "deleted": false,
    "excess_payments": 0,
    "first_name": "John",
    "id": "__test__8asukSOXe0g2Sc",
    "last_name": "Doe",
    "net_term_days": 0,
    "object": "customer",
    "pii_cleared": "active",
    "preferred_currency_code": "USD",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1612890939000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1612890939
  },
  "subscription": {
    "activated_at": 1612890939,
    "billing_period": 1,
    "billing_period_unit": "month",
    "created_at": 1612890939,
    "currency_code": "USD",
    "current_term_end": 1615310139,
    "current_term_start": 1612890939,
    "customer_id": "__test__8asukSOXe0g2Sc",
    "deleted": false,
    "due_invoices_count": 1,
    "due_since": 1612890939,
    "has_scheduled_changes": true,
    "id": "__test__8asukSOXe0ksSf",
    "item_tiers": {},
    "mrr": 0,
    "next_billing_at": 1615310139,
    "object": "subscription",
    "remaining_billing_cycles": 1,
    "resource_version": 1612890940000,
    "started_at": 1612890939,
    "status": "active",
    "subscription_items": [
      {
        "amount": 8000,
        "billing_cycles": 1,
        "free_quantity": 0,
        "item_price_id": "basic-USD",
        "item_type": "plan",
        "object": "subscription_item",
        "quantity": 4,
        "unit_price": 2000
      },
      {..}
    ],
    "total_dues": 1100,
    "updated_at": 1612890940
  }
}
```

## URL Format

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

## Returns

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

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

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