Get payment methods
To get a list of previously added payment methods that the user can create payments with (e.g. a specific card or Swish) call thegetPaymentMethods
function.info
You need to register a user token to get a successful response.
Getting payment methods
Parameter | Description |
---|---|
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)
SveaAppWallet.shared.getPaymentMethods() { [weak self] result in
switch result {
case .success(let paymentMethods):
print("Got payment methods: \(paymentMethods)")
case .failure(let error):
print("Could not get payment methods, got error: \(error)")
}
}
SveaWalletClient.shared.getPaymentMethods() { [weak self] result in
switch result {
case .onSuccess(let paymentMethods):
print("Got payment methods: \(paymentMethods)")
case .onFailure(let error):
print("Could not get payment methods, got error: \(error)")
}
}
onSuccess
Returned if successful, including a list of PaymentMethod
objects retrieved
from the Svea backend.
onFailure
Returned if the request to fetch payment options failed.
Possible errors
case noUserTokenProvided // A user token has not been provided.
case failedToRetrievePaymentMethods // The request could not be completed.
case unknownError // An unknown error occurred.