Is there a way to add multiple passes to Apple Wallet in one click?

When downloading a .zip file with a pass package, when trying to open a file it only appears as a file but is not added to the wallt.

Answered by DTS Engineer in 893639022

Hi @BrendaCR, @Globobalear,

PKAddPassesViewController

With PassKit and PKAddPassesViewController, you provide an array of PKPass objects. This allows you to present multiple passes at once in a single UI prompt, and the user can add them all in one confirmation.

let passes: [PKPass] = [pass1, pass2, pass3]
let addPassesVC = PKAddPassesViewController(passes: passes)
present(addPassesVC, animated: true)

The user is presented with all passes at once, and then taps "Add All".

PKPassLibrary APIs

There are also PKPassLibrary APIs for adding passes:

  • Adding passes via alert (no view controller)
  • Adding passes in the background

Adding passing via alert (no view controller)

Use addPasses to present a lightweight system alert instead of a full PKAddPassesViewController flow. This gives users the option to immediately add or preview the passes:

let passes: [PKPass] = [pass1, pass2, pass3]
let passLibrary = PKPassLibrary()

passLibrary.addPasses(passes) { status in
    switch status {
    case .shouldReviewPasses:
        // User chose to review/preview before adding
        if let addPassesVC = PKAddPassesViewController(passes: passes) {
            self.present(addPassesVC, animated: true)
        } else {
            // Handle fallback
        }
    case .didAddPasses:
        // User added all passes directly from the alert
        print("Passes added successfully.")
    case .didCancelAddPasses:
        // User dismissed the alert
        print("User cancelled.")
    @unknown default:
        break
    }
}

The completion handler returns a PKPassLibraryAddPassesStatus value, letting you know whether the user added the passes immediately, chose to review them (in which case you can fall back to presenting PKAddPassesViewController), or cancelled.

Adding passes in the background

Use requestAuthorization to request permission to add passes without any user-facing prompt at the moment of addition. This is recommended if your app adds passes to Wallet regularly. For example, airline check-in flows, movie theaters, or ticketing apps:

let passes: [PKPass] = [pass1, pass2, pass3]
let passLibrary = PKPassLibrary()

// Request authorization to add passes in the background
passLibrary.requestAuthorization(for: .addPasses) { result in
    if result == .authorized {
        // You can now add passes in the background
        do {
            try passLibrary.addPasses(passes)
        } catch {
            print("Error adding passes: \(error)")
        }
    } else {
        // Fall back to alert-based or view controller approach
    }
}

.pkpasses File Format

Otherwise, as @AlexanderCerutti, says, you can bundle multiple .pkpass files into a single .pkpasses (plural) file, which is a zip archive. When a user opens or taps this file (via email, Safari, Messages, etc.), Wallet will prompt them to add all included passes at once.

Note: If an app or website allows a user to download a .pkpasses bundle, tapping it will let them add all passes in one step. Otherwise, each .pkpass file typically requires a separate tap or confirmation to add individually.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

I'm interested in this topic, is there any news?

There's .pkpasses format, which is a zip file (just like .pkpass) with several .pkpass inside, but apparently this is supported only in Safari and Mail (still don't understand why but this sounds stupid)

Hi @BrendaCR, @Globobalear,

PKAddPassesViewController

With PassKit and PKAddPassesViewController, you provide an array of PKPass objects. This allows you to present multiple passes at once in a single UI prompt, and the user can add them all in one confirmation.

let passes: [PKPass] = [pass1, pass2, pass3]
let addPassesVC = PKAddPassesViewController(passes: passes)
present(addPassesVC, animated: true)

The user is presented with all passes at once, and then taps "Add All".

PKPassLibrary APIs

There are also PKPassLibrary APIs for adding passes:

  • Adding passes via alert (no view controller)
  • Adding passes in the background

Adding passing via alert (no view controller)

Use addPasses to present a lightweight system alert instead of a full PKAddPassesViewController flow. This gives users the option to immediately add or preview the passes:

let passes: [PKPass] = [pass1, pass2, pass3]
let passLibrary = PKPassLibrary()

passLibrary.addPasses(passes) { status in
    switch status {
    case .shouldReviewPasses:
        // User chose to review/preview before adding
        if let addPassesVC = PKAddPassesViewController(passes: passes) {
            self.present(addPassesVC, animated: true)
        } else {
            // Handle fallback
        }
    case .didAddPasses:
        // User added all passes directly from the alert
        print("Passes added successfully.")
    case .didCancelAddPasses:
        // User dismissed the alert
        print("User cancelled.")
    @unknown default:
        break
    }
}

The completion handler returns a PKPassLibraryAddPassesStatus value, letting you know whether the user added the passes immediately, chose to review them (in which case you can fall back to presenting PKAddPassesViewController), or cancelled.

Adding passes in the background

Use requestAuthorization to request permission to add passes without any user-facing prompt at the moment of addition. This is recommended if your app adds passes to Wallet regularly. For example, airline check-in flows, movie theaters, or ticketing apps:

let passes: [PKPass] = [pass1, pass2, pass3]
let passLibrary = PKPassLibrary()

// Request authorization to add passes in the background
passLibrary.requestAuthorization(for: .addPasses) { result in
    if result == .authorized {
        // You can now add passes in the background
        do {
            try passLibrary.addPasses(passes)
        } catch {
            print("Error adding passes: \(error)")
        }
    } else {
        // Fall back to alert-based or view controller approach
    }
}

.pkpasses File Format

Otherwise, as @AlexanderCerutti, says, you can bundle multiple .pkpass files into a single .pkpasses (plural) file, which is a zip archive. When a user opens or taps this file (via email, Safari, Messages, etc.), Wallet will prompt them to add all included passes at once.

Note: If an app or website allows a user to download a .pkpasses bundle, tapping it will let them add all passes in one step. Otherwise, each .pkpass file typically requires a separate tap or confirmation to add individually.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

Is there a way to add multiple passes to Apple Wallet in one click?
 
 
Q