Remove payment method

To remove a card or an invoice, call the removePaymentMethod function.
info

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

Removing a payment method

ParameterDescription
aliasA valid payment method 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 paymentMethodAlias = "8f66b624-fb16-11e9-8f0b-362b9e155667"

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

SveaWalletClient.shared.removePaymentMethod(withAlias: paymentMethodAlias) { [weak self] result in
    switch result {
    case .onSuccess:
            print("Payment method successfully removed!")
    case .onFailure(let error):
            print("Payment method 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 failedToRemovePaymentMethod     // The chosen payment method could not be removed.
case unknownError                    // An unknown error occurred.