# Cancel Subscription

Cancel an existing subscription.

## Example

Use the `$API->action('package', $package_id, 'cancel');` method to cancel an existing subscription.

```php
<?php
header('Content-Type: text/plain');

require '../ChargeOverAPI.php';
require 'config.php';

$API = new ChargeOverAPI($url, $authmode, $username, $password);

// This is the package we're cancelling
$package_id = 600;

// highlight-next-line
$resp = $API->action('package', $package_id, 'cancel');

if (!$API->isError($resp))
{
	print('Cancelled subscription!');

	/*
	print($API->lastRequest());
	print("\n\n\n");
	print($API->lastResponse());
	*/
}
else
{
	print('ERROR: ' . $resp->message);
}
```