> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AutoBill.cancel

The `cancel` method cancels a subscription (`AutoBill`).

A canceled `AutoBill` object no longer generates periodic billing transactions. However, if Subscribe has already picked up a current billing transaction to send to your payment processor, this call does not cancel the transaction, and you might choose to refund it later.

With this method, you can cancel an `AutoBill` object within the minimum commitment period by enabling the *force* option.

Canceling an `AutoBill` does not automatically disentitle the customer immediately. Calling `cancel` on an `AutoBill` allows entitlement to continue, as determined by the last successful billing. If you wish to disentitle immediately upon cancellation of the `AutoBill`, set the *disentitle* flag to `true`.

Canceling an `AutoBill` before the minimum commitment period is over will stop the `AutoBill` but allow the customer continued access to the service. To immediately disentitle the customer, set the *disentitle* flag to `true` when making this call.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*autobill*: `AutoBill` object to cancel. You can identify this object with either its VID or your `AutoBill` ID ().

*disentitle*: Boolean flag that, when set to `true`, cancels the related entitlements immediately. Otherwise, the entitlements continue through the end-date, as determined by the last successful billing for this `AutoBill` object.

*force*: Boolean flag that, when set to `true`, cancels the subscription even if the minimum commitment period for this `AutoBill` object has not been satisfied. In the case of an `AutoBill` that has a `BillingPlan` with a `minimumCommitment` period, and the subscription is still in the commitment period, the penalty is calculated as defined in the `cancelFeePolicy` field.

*settle*: Boolean flag that specifies whether to settle the `AutoBill` when it is canceled. When set to `true`, an attempt will be made to settle the `AutoBill` by either refunding the customer for a portion of the prepaid use that will not be available, or by charging for non-recurring-charges that the customer has not yet paid. When set to `false` or not specified, the charges or credits remaining on the `AutoBill` will not be changed, and will be carried forward in the balance for the `AutoBill`. How the `AutoBill` is settled will be reflected by the *transactions/refunds*/ included in the output.

*sendCancellationNotice*: Boolean flag that, when set to `true`, sends a cancellation email. When set to `false`, no cancellation email is sent. If this flag is not specified, the default value is `true`.

*cancelReasonCode*: (optional) reason for canceling the AutoBill. You can use predefined Subscribe cancel reason codes, or define additional codes using the Subscribe Portal or the API. (See Canceling AutoBills with Reason Codes in the Subscribe Programming Guide.) Supplying an undefined cancel reason code will result in an error.

*cancelFeePolicy*: policy for handling the settlement fee. Options for specifying how to cancel the policy include:

* `Waive the Cancel Fee`—the default.
* `Prorate Cancel Fee`—calculate fee based on time remaining in the commit period.
* `Full Cancel Fee`—apply the full early cancellation fee.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*autobill*: the `AutoBill` object that was canceled.

*transactions*: an array of `Transaction` objects that may be refunded if the `settle` input field is set to `true`.

*refunds*: an array of `Refund` objects that may be refunded if the `settle` input field is set to `true`.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | One of the following: - `Unable to load AutoBill: No match.` - `Unable to load AutoBill: *error-description*.` - `Error saving AutoBill: *error-description*.` |
| `403` | `Minimum commitment not fulfilled for this AutoBill.` |
| `405` | `Unable to cancel upgraded AutoBill.` |

## Example

```

$autobillVid = '14e1dce6f48e901464fce22145982a59642aa9f4';

// Create an autobill object
$autobill = new AutoBill();
$autobill->setVID($autobillVid);
$immediateDisentitlement = false;
$force = true; // allowing to cancel even if min commitment 
// is not fulfilled
$response = $autobill->cancel($immediateDisentitlement, $force)
if($response['returnCode'] == 200) {
   $cancelledAutoBill = $response['data']->autobill;

   print "AutoBill has been successfully cancelled\n";

   // If you are using Subscribe API version 3.3 or greater you can
   // also use the following construct

   print "You are entitled to use current services till "
   . $cancelledAutoBill->getEndTimestamp() . "\n";

}
```

**Parent topic:**[AutoBill Methods](../topics/AutoBill_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.