# Merchant Card

The Merchant Card resource stores information about cards used in approved purchases.

These cards can be used in new purchases without the need to create a new session.

### The Merchant Card object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the merchant card. |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `ending` | STRING | Last 4 digits of the card number. |
| `expiration` | STRING | Card expiration datetime. Example: "2035-02-01T02:59:59.999999+00:00". |
| `fundingType` | STRING | Funding type. Options: "credit", "debit". |
| `holderName` | STRING | Name of the card holder. |
| `network` | STRING | Card network. |
| `productId` | STRING | First digits (BIN) of the card. |
| `status` | STRING | Current card status. Options: "active", "expired", "canceled", "blocked". |
| `tags` | LIST OF STRINGS | Tags associated with the card. |
| `updated` | STRING | Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00". |

### List Merchant Cards

`GET /v2/merchant-card`

Get a list of merchant cards in chunks of at most 100. If you need smaller chunks, use the limit parameter.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `status` | OPTIONAL | Filter cards by the specified status, such as: active, expired, canceled or blocked. |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |

**Request**

```python
import starkbank

merchant_cards = starkbank.merchantcard.query(limit=1)

for merchant_card in merchant_cards:
    print(merchant_card)
```

**Response**

```python
MerchantCard(
    created=2025-02-18 18:39:28.597425,
    ending=0007,
    expiration=2045-02-01 02:59:59.999999,
    funding_type=credit,
    holder_name=Margaery Tyrell,
    id=6295415968235520,
    network=mastercard,
    status=active,
    tags=[],
    updated=2025-02-19 20:08:50.497358
)
```

### Get a Merchant Card

`GET /v2/merchant-card/:id`

Retrieve detailed information about a specific card by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | The unique identifier for the merchant card that needs to be retrieved. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

merchant_card = starkbank.merchantcard.get('6295415968235520')

print(merchant_card)
```

**Response**

```python
MerchantCard(
    created=2025-02-18 18:39:28.597425,
    ending=0007,
    expiration=2045-02-01 02:59:59.999999,
    funding_type=credit,
    holder_name=Margaery Tyrell,
    id=6295415968235520,
    network=mastercard,
    status=active,
    tags=[],
    updated=2025-02-19 20:08:50.497358
)
```

### List Merchant Card Logs

`GET /v2/merchant-card/log`

Get a paged list of merchant card logs.

A log tracks a change in the card entity according to its lifecycle.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cardIds` | OPTIONAL | Array of card ids that are linked to the logs you desire. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `types` | OPTIONAL | Filters logs by log types. |

**Request**

```python
import starkbank

logs = starkbank.merchantcard.log.query(limit=1)

for log in logs:
    print(log)
```

**Response**

```python
Log(
    created=2025-02-18 18:39:28.612480,
    errors=[],
    id=4888041084682240,
    card=MerchantCard(
        created=2025-02-18 18:39:28.597425,
        ending=0007,
        expiration=2045-02-01 02:59:59.999999,
        funding_type=credit,
        holder_name=Margaery Tyrell,
        id=6295415968235520,
        network=mastercard,
        status=active,
        tags=[],
        updated=2025-02-19 20:08:50.497358
    ),
    type=active,
)
```

### Get a Merchant Card Log

`GET /v2/merchant-card/log/:id`

Get a single merchant card log by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | The unique identifier for the merchant card that needs to be retrieved. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

merchant_card_log = starkbank.merchantcard.log.get('4888041084682240')

print(merchant_card_log)
```

**Response**

```python
Log(
    created=2025-02-18 18:39:28.612480,
    errors=[],
    id=4888041084682240,
    card=MerchantCard(
        created=2025-02-18 18:39:28.597425,
        ending=0007,
        expiration=2045-02-01 02:59:59.999999,
        funding_type=credit,
        holder_name=Margaery Tyrell,
        id=6295415968235520,
        network=mastercard,
        status=active,
        tags=[],
        updated=2025-02-19 20:08:50.497358
    ),
    type=active,
    updated=None
)
```

## Available Languages

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

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