Remove payment method
To remove a card or an invoice, call theremovePaymentMethod
function.info
You need to register a user token to get a successful response.
Removing a payment method
Parameter | Description |
---|---|
alias | A valid payment method alias from the user wallet. |
receiveOn | The dispatch queue used when invoking the result callback handler. Defaults to main. |
onResult | Result callback handler. |
Please note
SveaWalletClient
is deprecated in version 3.1.0. Use new class SveaAppWallet
instead.
SveaAppWalletSveaWalletClient (deprecated)
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)")
}
}
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
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.