# Card Method

The Card Method resource is used to query the card purchase methods available in the Stark Infra API.

Card Method codes are used to define purchase method filters in the IssuingRules of your [Issuing Holder resource](https://docs.starkinfra.com/api/v2/issuing-holder.md) and [Issuing Card resource](https://docs.starkinfra.com/api/v2/issuing-card.md).

Not every method can be used in every rule: a rule on a virtual card accepts only the "token", "server", "manual" and "contactless" codes, while a rule on a physical card accepts all of them.

**Note:** Card Methods are never created by you. They are an enum served by the API, so this resource is query-only.

### The Card Method object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `code` | STRING | Method's code. Options: "chip", "token", "server", "manual", "magstripe", "contactless". Example: "token". |
| `name` | STRING | Method's name, translated to the language of the Accept-Language header. Example: "token". |
| `number` | STRING | Method's number. Example: "81". |

### List Card Methods

`GET /v2/card-method`

Use this route to list the card purchase methods available in the Stark Infra API.

**NOTE:** This route returns the full enum in a single response. It is not paginated, so it accepts no limit or cursor parameters and returns no cursor.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `search` | OPTIONAL | Keyword to search for code, name or number. The match is case- and accent-insensitive. Example: "token". |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkinfra

methods = starkinfra.cardmethod.query(
    search="token"
)

for method in methods:
    print(method)
```

**Response**

```python
CardMethod(
    code=token,
    name=token,
    number=81
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkinfra.com/api/v2/card-method-python.md)
- [Node.js](https://docs.starkinfra.com/api/v2/card-method-node.md)
- [PHP](https://docs.starkinfra.com/api/v2/card-method-php.md)
- [Java](https://docs.starkinfra.com/api/v2/card-method-java.md)
- [Ruby](https://docs.starkinfra.com/api/v2/card-method-ruby.md)
- [Elixir](https://docs.starkinfra.com/api/v2/card-method-elixir.md)
- [.NET](https://docs.starkinfra.com/api/v2/card-method-dotnet.md)
- [Go](https://docs.starkinfra.com/api/v2/card-method-go.md)
- [Clojure](https://docs.starkinfra.com/api/v2/card-method-clojure.md)
- [cURL](https://docs.starkinfra.com/api/v2/card-method-curl.md)
