Remove a card

Introduced 1.0.0

Deprecated 1.3.0
To remove a card, call the removeCard function.
info

You need to register a user token to get a successful response.

Removing a card

ParameterDescription
aliasA valid payment card alias from the user wallet.
receiveOnThe dispatch queue used when invoking the result callback handler. Defaults to main.
onResultResult callback handler.
Please note
SveaWalletClient is deprecated in version 3.1.0. Use new class SveaAppWallet instead.
SveaAppWalletSveaWalletClient (deprecated)
Copy
Copied
let cardAlias = "8f66b624-fb16-11e9-8f0b-362b9e155667"

SveaSveSveaAppWalletaAppWalletallet.shared.removePaymentMethod(withAlias: cardAlias) { [weak self] result in
    switch result {
    case .success:
            print("Card successfully removed!")
    case .failure(let error):
            print("Card could not be removed, got error: \(error)")
    }
}
Copy
Copied
let cardAlias = "8f66b624-fb16-11e9-8f0b-362b9e155667"

SveaWalletClient.shared.removeCard(withAlias: cardAlias) { [weak self] result in
    switch result {
    case .onSuccess:
            print("Card successfully removed!")
    case .onFailure(let error):
            print("Card could not be removed, got error: \(error)")
    }
}

onSuccess

Returned when the card is successfully removed from the list of available payment methods.

onFailure

Returned when an error occurs. If this happens, the card has not been removed.

Possible errors

Copy
Copied
case noUserTokenProvided    // A user token has not been provided.
case failedToRemoveCard     // The chosen card could not be removed.
case unknownError           // An unknown error occurred.