Pay with card
Making a card payment
Fetch the payment token from your backend. Once the token is registered, the user is able to make a card payment.
info
If a payment needs to be verified with 3DSecure, a web view will be shown to the user.
The Svea App Wallet SDK will automatically dismiss this view once the transaction is processed.
The 3DSecure session is valid for 10 minutes.
Parameter | Description |
---|---|
token | A valid payment token from your backend. |
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.pay(withToken: paymentToken) { [weak self] result in
switch result {
case .success:
print("Payment completed!")
case let .failure(error):
print("Could not complete payment, got error: \(error)")
}
}
SveaWalletClient.shared.pay(withToken: paymentToken) { [weak self] result in
switch result {
case .onSuccess:
print("Payment completed!")
case let .onFailure(error):
print("Could not complete payment, got error: \(error)")
}
}
onSuccess
Returned when the payment was successful.
info
Please note that information about the purchase, such as the amount paid, is fetched from your backend.
onFailure
Returned when an error occurs. If this happens, the payment has failed.
Possible errors
case noPaymentTokenProvided // A payment token has not been provided.
case failedToConfirmPayment // The payment could not be confirmed.
case failedToPay // The payment was not successful.
case unknownError // An unknown error occurred.