Get payment plan options
Important
To create a payment plan the user is required to have a private invoice payment method registered.
getPaymentPlanOptions function.To pay with payment plan you need to:
- Get and register UserToken in client SDK.
- Get payment methods and select private invoice
PaymentMethod - Get payment plan options and select a
PaymentPlanOption - Create a payment in your backend using private invoice and the
campaignCodefrom the selected payment plan option. A payment token will be returned. - Use the payment token to get a bankId URL.
- Open BankID with the URL.
info
Get payment plan options are available from SDK versions:
Android: 2.6.0
iOS: 3.4.0
Android: 2.6.0
iOS: 3.4.0
Getting payment plan options
| Parameter | Description |
|---|---|
| merchantId | A valid merchant id from your backend. |
| amount | A total amount need to paid. |
| receiveOn | The dispatch queue used when invoking the result callback handler. Defaults to main. |
| onResult | Result callback handler. |
SveaAppWallet.shared.getPaymentPlanOptions(merchantId: String,
amount: Double) { [weak self] result in
switch result {
case .success(let paymentPlanOptions):
print("Got available payment plan options list: \(paymentPlanOptions)")
case .failure(let error):
print("Could not get payment plan options, got error: \(error)")
}
}onSuccess
Returned if successful, including a list of PaymentPlanOption objects retrieved
from the Svea backend.
onFailure
Returned if the request to fetch payment plan options failed.
Possible errors
case noUserTokenProvided // A user token has not been provided.
case failedToRetrievePaymentPlanOptions // The request could not be completed.