---
id: cancel-token
title: Cancelling a token
hide_title: true
description: "Cancellation of a customer-token"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Ingress from "../../../src/components/ingress/ingress.react";

<Ingress title="Cancelling a token">
If you wish to cancel the possibility to charge a certain customer token, you can do that by cancelling the token.
If the customer wants to start payments again, they'll need to give consent anew to create a new token.
It's a good idea to cancel a token when it's no longer needed, for example if a customer ends their subscription.
</Ingress>

## Cancelling a customer token

<Tabs defaultValue="req" values={[
{ label: 'Request', value: 'req' },
{ label: 'Response', value: 'res' },
{ label: 'Error', value: 'err' }
]}>

<TabItem value="req">
```http
DELETE /purchase/customer-tokens/916f7730-8d24-4dd9-9778-92b75b747382 HTTP/1.1
Host: api.uat.walleydev.com
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
```
</TabItem>

<TabItem value="res">
```http
HTTP/1.1 202 Accepted
Content-Type: application/json

{
  "id": "17635160-e66f-46b9-84fc-db939005050c"
}
```

</TabItem>

<TabItem value="err">
Example error. More errors available below.

```http
HTTP/1.1 404 Not Found
Content-Type: application/json

{
  "id": "fe8a21bb-6cb5-4d7d-b7f6-c0c335fc4593",
  "error": {
    "code": 404,
    "message": "The resource requested was not found.",
    "errors": []
  }
}
```
</TabItem>
</Tabs>
## Request properties

**Request headers**

| Header            | Required | Explanation                                                                                                       |
| ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| **Authorization** | Yes      | See [how to generate the authorization header value](/docs/checkout/authorization).                               |


## Important error responses

| Error code | Cause                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------- |
| **401**    | Incorrect, missing or expired bearer token                                                                          |
| **403**    | The customer token was already cancelled                                                                            |
| **404**    | The customer token was not found for the authenticated bearer token                                                 |
| **503**    | There was some internal error. Please try again                                                                     |