# Resume subscription estimate

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


Generates an estimate for the 'resume subscription' operation. This is similar to the [Resume a subscription](/docs/api/subscriptions/resume-a-subscription) API, but the subscription will not be resumed. Only an estimate for this operation is created.

In the response,

-   **estimate.subscription\_estimate** has the subscription details.

**estimate.invoice\_estimate** has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation. This will happen for in-term resumption++ .

**++What is an "in-term resumption"?**

An "in-term resumption" is when the resumption happens within the billing term of the subscription.

**estimate.next\_invoice\_estimate** has details of the invoice that will be generated during the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation (scenario mentioned above) and this subscription has next billing.

The generated invoice\_estimate/next\_invoice\_estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html) , Refundable Credits, and Excess Payments - if any.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/subscriptions/__test__8asyKSOcebwWOw/resume_subscription_estimate \
     -u {site_api_key}:\
     -d resume_option="IMMEDIATELY"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.ResumeSubscription("__test__8asyKSOcebwWOw")
		.ResumeOption(ResumeOptionEnum.Immediately)
		.Request();

Estimate estimate = result.Estimate;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    estimateAction "github.com/chargebee/chargebee-go/v3/actions/estimate"
    "github.com/chargebee/chargebee-go/v3/models/estimate"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.ResumeSubscription("__test__8asyKSOcebwWOw", &estimate.ResumeSubscriptionRequestParams{
        ResumeOption : enum.ResumeOptionImmediately,
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Estimate := res.Estimate
    }
}
```

#### 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.EstimateResumeSubscriptionRequest{
    ResumeOption : chargebee.ResumeOptionImmediately,
}
  res, err := client.Estimate.ResumeSubscription("__test__8asyKSOcebwWOw", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Estimate := res.Estimate
    }
}
```

#### 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 = Estimate.resumeSubscription("__test__8asyKSOcebwWOw")
            .resumeOption(ResumeOption.IMMEDIATELY)
            .request();

        Estimate estimate = result.estimate();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.estimate.Estimate;
import com.chargebee.v4.models.estimate.params.EstimateResumeSubscriptionParams;
import com.chargebee.v4.models.estimate.responses.EstimateResumeSubscriptionResponse;

public class EstimateResumeSubscription {

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

        EstimateResumeSubscriptionParams params = EstimateResumeSubscriptionParams.builder()
            .resumeOption(EstimateResumeSubscriptionParams.ResumeOption.IMMEDIATELY)
            .build();

        EstimateResumeSubscriptionResponse response = client
            .estimates()
            .resumeSubscription("__test__8asyKSOcebwWOw", params);

        Estimate estimate = response.getEstimate();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.estimate.resumeSubscription("__test__8asyKSOcebwWOw", {
        resume_option: "immediately"
    });

    console.log(result);
    const estimate = result.estimate;
} 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->estimate()->resumeSubscription("__test__8asyKSOcebwWOw", [
    "resume_option" => "immediately"
]);
$estimate = $result->estimate;
```

#### Python

```python
import chargebee
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.resume_subscription("__test__8asyKSOcebwWOw",
    cb_client.Estimate.ResumeSubscriptionParams(
        resume_option=chargebee.ResumeOption.IMMEDIATELY
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.resume_subscription("__test__8asyKSOcebwWOw",{
  :resume_option => "IMMEDIATELY"
})

estimate = result.estimate
```

## Sample Response

```json
{
  "estimate": {
    "created_at": 1517492964,
    "next_invoice_estimate": {
      "amount_due": 2000,
      "amount_paid": 0,
      "credits_applied": 0,
      "currency_code": "USD",
      "customer_id": "__test__8asyKSOcebrPOp",
      "line_item_discounts": {},
      "line_item_taxes": {},
      "line_items": [
        {
          "amount": 1000,
          "customer_id": "__test__8asyKSOcebrPOp",
          "date_from": 1517492964,
          "date_to": 1519912164,
          "description": "basic USD",
          "discount_amount": 0,
          "entity_id": "basic-USD",
          "entity_type": "plan_item_price",
          "id": "li___test__8asyKSOcebyEOy",
          "is_taxed": false,
          "item_level_discount_amount": 0,
          "object": "line_item",
          "pricing_model": "per_unit",
          "quantity": 1,
          "subscription_id": "__test__8asyKSOcebwWOw",
          "tax_amount": 0,
          "unit_amount": 1000
        },
        {..}
      ],
      "object": "invoice_estimate",
      "price_type": "tax_exclusive",
      "recurring": true,
      "round_off_amount": 0,
      "sub_total": 2000,
      "taxes": {},
      "total": 2000
    },
    "object": "estimate",
    "subscription_estimate": {
      "currency_code": "USD",
      "id": "__test__8asyKSOcebwWOw",
      "next_billing_at": 1519912164,
      "object": "subscription_estimate",
      "status": "active"
    }
  }
}
```

## URL Format

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

## Input Parameters

- `resume_option` (optional, enumerated string)
  List of options to resume the subscription.
  Possible enum values:
    - `immediately`
      Resume immediately
    - `specific_date`
      Resume on a specific date

- `charges_handling` (optional, enumerated string)
  Applicable when charges get added during this operation and **resume\_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges.
  Possible enum values:
    - `invoice_immediately`
      Invoice immediately
    - `add_to_unbilled_charges`
      Add to unbilled charges

- `subscription` (optional, timestamp(UTC) in seconds)
  Parameters for subscription
  - `resume_date` (optional, timestamp(UTC) in seconds)
    For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned.

## Returns

- `estimate` (Estimate object)
  Resource object representing estimate
