---
id: token-details
title: Getting token details
hide_title: true
description: "Get details of a customer-token"
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Ingress from "../../../src/components/ingress/ingress.react";

<Ingress title="Getting token details">
    To retrieve the current state and details of a customer token.
</Ingress>

## Getting token details

<Tabs defaultValue="req" values={[
{ label: 'Request', value: 'req' },
{ label: 'Response', value: 'res' },
{ label: 'Error', value: 'err' }
]}>

<TabItem value="req">
```http
GET /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 200 OK
Content-Type: application/json

{
  "id": "ee634b96-f40e-426a-be3f-3533a7f6a400",
  "data": {
    "status": "Active",
    "paymentMethod": {
      "type": "Card",
      "maskedCardNumber": "516020******2127"
    },
    "buyer": {
      "email": "customer@example.com",
      "mobilePhone": "+46701234567"
    }
  }
}
```

</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

**Request headers**

| Header                     | Required | Explanation                                                                         |
|----------------------------|----------|-------------------------------------------------------------------------------------|
| **Authorization**          | Yes      | `Bearer <access_token>`. See [Authorization](/docs/checkout/authorization).         |
| **Walley-Idempotency-Key** | No       | A Guid. See [Idempotent Requests](/docs/checkout/tokenization/idempotent-requests). |

## Response

All responses return a JSON object with either a data object or an error object.

| Property  | Type   | Explanation                              |
|-----------|--------|------------------------------------------|
| **id**    | Guid   | Correlation ID for this request          |
| **data**  | object | Present on success. See [Data object.](#data-object)     |
| **error** | object | Present on failure. See [Error object.](#error-object)    |

### Data object

| Property             | Type   | Included | Description                                     |
|----------------------|--------|----------|-------------------------------------------------|
| **status**           | string | Always   | Token status. See [Status values.](#status-values)                |
| **cancellationDate** | date   | Maybe    | ISO 8601 date-time if the token is cancelled.   |
| **paymentMethod**    | object | Always   | Details of the payment method used by the token. See [PaymentMethod object.](#paymentmethod-object) |
| **buyer**            | object | Maybe    | Buyer information associated with the token. See [Buyer object.](#buyer-object) |

#### Status values

 - `Active` - Token is active and can be used for authorizations
 - `Pending` - Token is pending approval
 - `Denied` - Token approval was denied; cannot be used.
 - `Revoked` - Token approval was revoked; cannot be used.
 - `Cancelled` - Token has been cancelled via the [cancel endpoint](/docs/checkout/tokenization/cancel-token); cannot be used

#### PaymentMethod object

| Property             | Type   | Included    | Description                                                  |
|----------------------|--------|-------------|--------------------------------------------------------------|
| **type**             | string | Always      | One of `Credit`, `Card` or `Swish`                           |
| **invoiceType**      | string | if `Credit` | One of `Email`, `Peppol` or `Finvoice`                       |
| **invoiceReference** | string | if `Credit` | Reference chosen by the customer when registering the token. |
| **invoiceTag**       | string | if `Credit` | Tag chosen by the customer when registering the token.       |
| **maskedCardNumber** | string | if `Card`   | The masked card number like '516020******2127'               |
| **maskedPayerAlias** | string | if `Swish`  | The masked Swish payer alias like '****7654'                 |

#### Buyer object

| Property         | Type   | Included | Description                                  |
|------------------|--------|----------|----------------------------------------------|
| **email**        | string | Maybe    | The buyer's email address.                   |
| **mobilePhone**  | string | Maybe    | The buyer's mobile phone number.             |

### Error object

| Property    | Type    | Description                                        |
|-------------|---------|----------------------------------------------------|
| **code**    | integer | HTTP status code.                                  |
| **message** | string  | General description of the error.                  |
| **errors**  | array   | List of specific validation errors, if applicable. |

| Property    | Type   | Description                                                 |
|-------------|--------|-------------------------------------------------------------|
| **reason**  | string | Error type or category (e.g., `ValidationError`).           |
| **message** | string | Human-readable explanation of the validation issue.         |
| **field**   | string | Field name in the request that caused the validation error. |

**Error codes**
| Error code | Cause                                                               |
|------------|---------------------------------------------------------------------|
| **400**    | Bad request, for example invalid token format                       |
| **401**    | Incorrect, missing or expired bearer token                          |
| **404**    | The customer token was not found for the authenticated bearer token |
| **503**    | There was some internal error. Please try again                     |