Create a recurring account

To create an account you need to:

  1. Get and register UserToken in client SDK
  2. Get available recurring account types. and select a RecurringType
  3. Create recurring account in the server API and get string token
  4. Gather card details
  5. Call createRecurringAccount in Client with the token from previous step and cardInformation (SDK will trigger 3DS check if needed)
  6. Verify account status through server (Client will return an initial success or fail, but the status should be verify through server)

This example uses RecurringCard as account type

Creating Recurring Account Flow
Recurring Accounts are available from SDK versions:
Android: 2.4.0
iOS: 3.2.0

Creating card information object

As the user enters their card information, create a CardInformation object.

Adding a recurring card


If a card needs to be 3DSecure enrolled, then a web view will be shown to the user.
The Svea App Wallet SDK will automatically dismiss this view once the information is processed.

The 3DSecure session is valid for 20 minutes.

recurringAccountTokenA valid recurring account token from your backend.
cardA CardInformation object.
receiveOnThe dispatch queue used when invoking the result callback handler. Defaults to main.
onResultResult callback handler.
let cardInformation = CardInformation(
    cardNumber: "XXXXXXXXXXXXXXXX",
    expirationDate: CardDate(
        month: "12",
        year: "20"
    label: "My card",
    securityCode: "XXX"

SveaAppWallet.shared.createRecurringAccount(recurringAccountToken: recurringAccountToken,
                                            card: cardInformation) { [weak self] result in
    switch result {
    case .success:
            print("Recurring account card successfully added!")
    case .failure(let error):
            print("Recurring account card could not be added, got error \(error)")


Returned if the recurring card was successfully created.

Please note

The initial, unmasked card information added by the user should never be saved in your systems.


Returned if the card cannot be added.

Possible errors

case noRecurringAccountTokenProvided    // A recurring token was not provided.
case invalidCardNumber                  // The card number is not valid.
case invalidMonth                       // The month value is bigger than 12 or smaller than 1.
case invalidYear                        // The year value is not 2 digits.
case monthInThePast                     // The selected year is valid, but the month has passed.
case yearInThePast                      // The selected year has passed.
case invalidSecurityCode                // Invalid security code.
case failedToCreateRecurringAccount     // Something went wrong while creating account.

Test cards

In the stage environment test cards are expected.
Use one of the test card numbers from the list below together with an expire date in the future and random cvc code.


These test cards should only be used in stage. Real card information should only be used in production.