# antom.destroy()

> Use the antom.destroy() method to destroy the antom instance (the SDK instance returned by loadAntom()) and release all associated resources.

Use this method to destroy the `antom` instance (the SDK instance returned by [`loadAntom()`](https://docs.antom.com/ac/sdks/web_loadAntom.md)) and releases all associated resources. After calling `antom.destroy()`, the SDK instance can no longer be used. Difference of this method from [`element.destroy()`](https://docs.antom.com/ac/sdks/web_element-destroy.md) is as stated below:

-   `antom.destroy()`: Destroys the entire SDK instance and simultaneously destroys all Elements created through this instance.
-   [`element.destroy()`](https://docs.antom.com/ac/sdks/web_element-destroy.md): Destroys only a single Element instance.

> **Notes**:
>
> -   After the SDK instance is destroyed, methods such as [`antom.createElement()`](https://docs.antom.com/ac/sdks/web_antom-createElement.md), [`antom.confirmPayment()`](https://docs.antom.com/ac/sdks/web_antom-confirmPayment.md) and [`antom.confirmCardSetup()`](https://docs.antom.com/ac/sdks/web_antom-confirmCardSetup.md) can no longer be called.
> -   In general, the SDK does not automatically destroy itself; you need to manually call `antom.destroy()` to release resources.
> -   Calling `antom.destroy()` multiple times will not return an error, but subsequent calls will have no effect.

## **Method signature**

When calling this method, please use the following standard method signature format.

#### Tab: JavaScript

```javascript
antom.destroy()
```

#### Tab: TypeScript

```typescript
antom.destroy(): void
```

## **Parameters**

This method takes no input parameters.

## Return values

This method does not return any value.

## Usage scenarios

> **Note**: The following are typical examples and not an exhaustive list. You can determine how to release the component based on your specific business needs.

### Manual call

In the following cases, call this method to release SDK component resources:

-   When the buyer leaves the checkout page or switches views: When the buyer leaves the current checkout page (for example, navigates to another page or closes the checkout modal), it is recommended to call `antom.destroy` to to release the SDK instance and all Element resources created by it.
-   When switching to a payment method not provided by SDK: When the payment flow provided by the SDK is no longer needed and you need to switch to another payment solution, you should call  `antom.destroy`  to release all associated resources.


### Automatic release

In the following cases, the SDK automatically releases resources:

-   Payment succeeds without redirection to a result page: When the payment is successful and the process is configured not to redirect to a separate result page, the SDK automatically reclaims part of the resources used for the payment.