Get payment plan options

Important

To create a payment plan the user is required to have a private invoice payment method registered.

To get a list of available Payment plan options the user can create payment with payment plan call the getPaymentPlanOptions function.

To pay with payment plan you need to:

  1. Get and register UserToken in client SDK.
  2. Get payment methods and select private invoice PaymentMethod
  3. Get payment plan options and select a PaymentPlanOption
  4. Create a payment in your backend using private invoice and the campaignCode from the selected payment plan option. A payment token will be returned.
  5. Use the payment token to get a bankId URL.
  6. Open BankID with the URL.
Get Payment Plan Options Flow
info
Get payment plan options are available from SDK versions:
Android: 2.6.0
iOS: 3.4.0

Getting payment plan options

ParameterDescription
merchantIdA valid merchant id from your backend.
amountA total amount need to paid.
receiveOnThe dispatch queue used when invoking the result callback handler. Defaults to main.
onResultResult callback handler.
Copy
Copied
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

Copy
Copied
case noUserTokenProvided                        // A user token has not been provided.
case failedToRetrievePaymentPlanOptions         // The request could not be completed.