Pay with Invoice
Deprecated
Deprecated in version 2.6.0 for Android SDK and version 3.4.0 for iOS SDK.
Use
Use
getBankIdUrl instead.getBankIdTokenForPayment method, providing a payment token.After obtaining this token, the app should use it to start the BankId app. Once the BankId intent is handled, the app should call
getPaymentResponse in order to obtain the payment status.Get BankId Token
Provides a valid BankId token for this payment.
| Parameter | Description |
|---|---|
| receiveOn | The dispatch queue used when invoking the result callback handler. Defaults to main. |
| paymentToken | A payment token provider by the partner's backend |
| onResult | Result callback handler. |
Please note
SveaWalletClient is deprecated in version 3.1.0. Use new class SveaAppWallet instead.
SveaAppWalletSveaWalletClient (deprecated)
SveaAppWallet.shared.getBankIdTokenForPayment(paymentToken: paymentToken) { [weak self] result in
switch result {
case .success(let bankIdToken):
// Build bankId URL with token and open BankId if installed.
guard let bankUrl = URL(string: "bankid:///?autostarttoken=\(bankIdToken)&redirect=yourapp://example")
else { return } // Handle error creating url
UIApplication.shared.open(bankUrl. options: [:], completionHandler: nil])
case .failure(let error):
print("Could not get bankId token, got error \(error)")
}
}SveaWalletClient.shared.getBankIdTokenForPayment(paymentToken: paymentToken) { [weak self] result in
switch result {
case .onSuccess(let bankIdToken):
// Build bankId URL with token and open BankId if installed.
guard let bankUrl = URL(string: "bankid:///?autostarttoken=\(bankIdToken)&redirect=yourapp://example")
else { return } // Handle error creating url
UIApplication.shared.open(bankUrl. options: [:], completionHandler: nil])
case .onFailure(let error):
print("Could not get bankId token, got error \(error)")
}
}onSuccess
Returned when a BankId token is successfully generated.
onFailure
Returned when an error occurs.
Possible errors
case unknownError // An unknown error occurred.
case failedToRetrieveBankIdToken //The bankId token could not be fetchedGet payment response
Returns the status of an invoice payment.
| Parameter | Description |
|---|---|
| onResult | Result callback handler. |
SveaWalletClient.shared.getPaymentResponse() { [weak self] result in
switch result {
case .onSuccess():
print("Invoice payment completed!")
case .onFailure(let error):
print("Invoice payment could not be completed, got error \(error)")
}
}onSuccess
Returned when a BankId payment is successfully completed.
onFailure
Returned when an error occurs.
Possible errors
case unknownError // An unknown error occurred.
case failedToPay // Failed to pay using invoice.