# Pause subscription estimate

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


This API provides an estimate of the details pertaining to the `[pause_subscription](/docs/api/subscriptions/pause-a-subscription)` operation. It returns attributes such as `[pause_date](/docs/api/estimates/estimate-object#subscription_estimate_pause_date)` and `[resume_date](/docs/api/estimates/estimate-object#subscription_estimate_resume_date)`. This is similar to the [Pause a subscription](/docs/api/subscriptions/pause-a-subscription) API with the exception that the subscription is not paused. 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 are generated immediately. This is not present if no immediate invoices are generated for this operation.
-   **estimate.credit\_note\_estimates\[\]** has details of the credit notes that are generated during this operation. This list is empty if no credit notes are generated.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/subscriptions/__test__8asyKSOcebl8Oi/pause_subscription_estimate \
     -u {site_api_key}:\
     -d pause_option="SPECIFIC_DATE" \
     -d "subscription[pause_date]"=1566698400
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.PauseSubscription("__test__8asyKSOcebl8Oi")
		.PauseOption(PauseOptionEnum.SpecificDate)
		.SubscriptionPauseDate(1566698400)
		.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.PauseSubscription("__test__8asyKSOcebl8Oi", &estimate.PauseSubscriptionRequestParams{
        PauseOption : enum.PauseOptionSpecificDate,
        Subscription : &estimate.PauseSubscriptionSubscriptionParams{
            PauseDate : chargebee.Int64(1566698400),
        },
    }).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.EstimatePauseSubscriptionRequest{
    PauseOption : chargebee.PauseOptionSpecificDate,
    Subscription : &chargebee.EstimatePauseSubscriptionSubscription{
        PauseDate : chargebee.Int64(1566698400),
    },
}
  res, err := client.Estimate.PauseSubscription("__test__8asyKSOcebl8Oi", 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;
import java.sql.Timestamp;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Estimate.pauseSubscription("__test__8asyKSOcebl8Oi")
            .pauseOption(PauseOption.SPECIFIC_DATE)
            .subscriptionPauseDate(new Timestamp(1566698400L * 1000))
            .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.EstimatePauseSubscriptionParams;
import com.chargebee.v4.models.estimate.responses.EstimatePauseSubscriptionResponse;
import java.sql.Timestamp;

public class EstimatePauseSubscription {

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

        EstimatePauseSubscriptionParams.SubscriptionParams subscriptionParams =
            EstimatePauseSubscriptionParams.SubscriptionParams.builder()
                .pauseDate(new Timestamp(1566698400L * 1000))
                .build();

        EstimatePauseSubscriptionParams params = EstimatePauseSubscriptionParams.builder()
            .pauseOption(EstimatePauseSubscriptionParams.PauseOption.SPECIFIC_DATE)
            .subscription(subscriptionParams)
            .build();

        EstimatePauseSubscriptionResponse response = client
            .estimates()
            .pauseSubscription("__test__8asyKSOcebl8Oi", 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.pauseSubscription("__test__8asyKSOcebl8Oi", {
        pause_option: "specific_date",
        subscription: {
            pause_date: 1566698400
        }
    });

    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()->pauseSubscription("__test__8asyKSOcebl8Oi", [
    "pause_option" => "specific_date",
    "subscription" => [
        "pause_date" => 1566698400
    ]
]);
$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.pause_subscription("__test__8asyKSOcebl8Oi",
    cb_client.Estimate.PauseSubscriptionParams(
        pause_option=chargebee.PauseOption.SPECIFIC_DATE,
        subscription=cb_client.Estimate.PauseSubscriptionSubscriptionParams(
            pause_date=1566698400
        )
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.pause_subscription("__test__8asyKSOcebl8Oi",{
  :pause_option => "SPECIFIC_DATE",
  :subscription => {
    :pause_date => 1566698400
  }
})

estimate = result.estimate
```

## Sample Response

```json
{
  "estimate": {
    "created_at": 1517492963,
    "credit_note_estimates": {},
    "object": "estimate",
    "subscription_estimate": {
      "currency_code": "USD",
      "id": "__test__8asyKSOcebl8Oi",
      "next_billing_at": 1519912163,
      "object": "subscription_estimate",
      "pause_date": 1566698400,
      "status": "active"
    }
  }
}
```

## URL Format

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

## Input Parameters

- `pause_option` (optional, enumerated string)
  List of options to pause the subscription.
  Possible enum values:
    - `immediately`
      Pause immediately
    - `end_of_term`
      Pause at the end of current term
    - `specific_date`
      Pause on a specific date
    - `billing_cycles`
      Pause at the end of the current term, and resume automatically after the number of billing cycles you specify in `[skip_billing_cycles](/docs/api/estimates/pause-subscription-estimate#subscription_skip_billing_cycles)`

- `unbilled_charges_handling` (optional, enumerated string)
  Applicable when unbilled charges are present for the subscription and `[pause_option](/docs/api/estimates/pause-subscription-estimate#pause_option)` is set as `immediately`. **Note:** On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to `on`.
  Possible enum values:
    - `no_action`
      Retain as unbilled If `no_action` is chosen, charges are added to the resumption invoice.
    - `invoice`
      Invoice charges If `invoice` is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid.

- `subscription` (optional, timestamp(UTC) in seconds)
  Parameters for subscription
  - `pause_date` (optional, timestamp(UTC) in seconds)
    When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused.
  - `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.
  - `skip_billing_cycles` (optional, integer, min=1)
    Number of billing cycles this subscription should be paused. The subscription resumes after the paused billing cycles end.

## Returns

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