> For the complete documentation index, see [llms.txt](https://mercuryo.gitbook.io/mobilesdk-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mercuryo.gitbook.io/mobilesdk-en/cards.md).

# Cards

* [List of cards](/mobilesdk-en/cards.md#list-of-cards)
* [Adding card](/mobilesdk-en/cards.md#adding-card)
* [Removing card](/mobilesdk-en/cards.md#removing-card)

`CardManager` object needs to be obtained first to start working with cards:

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val mercuryo: Mercuryo = Mercuryo.create(...)  
val cardManager: CardManager = mercuryo.card
```

{% endtab %}

{% tab title="Swift" %}

```swift
var mercuryoSDK: IMercuryo = IMercuryo(isDebug: true, baseHost: "HOST_HERE")
var card = mercuryoSDK.card
```

{% endtab %}
{% endtabs %}

## List of cards

To get a list of linked cards, call the method:

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
cardManager.getCards(limit: Int, offset: Int): List<Card>
```

{% endtab %}

{% tab title="Swift" %}

```swift
mercuryoSDK.card.getCards(limit: 20, offset: 0) { cards, error in
    //do some magic here
}
```

{% endtab %}
{% endtabs %}

<div align="left"><img src="/files/-MTuQXKIhXuKJgwkfYTk" alt=""></div>

## Adding card

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
cardManager.bindCard(holderName: String, number: String, cvv: String, expirationMonth: String, expirationYear: String, redirectUrl: String): BindCard
```

{% endtab %}

{% tab title="Swift" %}

```swift
mercuryoSDK.card.bindCard(holderName: "HOLDER_NAME HERE", number: "5536 ...", cvv: "123", expirationMonth: "MM", expirationYear: "YYYY", redirectUrl: "REDIRECT_URL HELE") { bindCardInfo, error in 
    //do magic here
}
```

{% endtab %}
{% endtabs %}

| Parameter       | Description                                                                                                                                                                |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| holderName      | Cardholder name                                                                                                                                                            |
| number          | Number of card                                                                                                                                                             |
| cvv             | CVV of card                                                                                                                                                                |
| expirationMonth | Expiration month                                                                                                                                                           |
| expirationYear  | Expiration year                                                                                                                                                            |
| redirectUrl     | URL where user will be redirected to after operation. Example: [http://my.mercuryo.io/orders?invoice={invoice\_id}](http://my.mercuryo.io/orders?invoice=%7Binvoice_id%7D) |

## Removing card

To delete a card call the `deleteCard` method passing the card identifier.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
cardManager.deleteCard(cardId: String) 
```

{% endtab %}

{% tab title="Swift" %}

```swift
mercuryoSDK.card.deleteCard(cardId: "CARD_ID HERE") { _, error in
    //if no error than card deleted
}
```

{% endtab %}
{% endtabs %}
