avatarKristaps Grinbergs

Summary

Apple's PassKit framework enables the creation, distribution, and management of passes for Apple Pay and the Wallet app, including boarding passes, tickets, and loyalty cards.

Abstract

The Apple PassKit framework is a powerful tool for managing user passes in the Wallet app and facilitating Apple Pay transactions. This article discusses the process of creating and distributing passes, which are digital representations of information typically found on paper or plastic cards. Passes are created as packages with the extension .pass and consist of various components, including a pass.json file, a manifest.json file, and image assets. Required fields for creating a pass include the pass type identifier, serial number, format version, team identifier, organization name, and description. Passes can have different visual appearances, such as boardingPass, coupon, eventTicket, storeCard, and generic. After creating, signing, and compressing a pass into a bundle, it can be distributed via email, file sharing options like iCloud or AirDrop, or using the Add to Wallet button provided by Apple. Passes can now provide not only barcode information but also NFC data, making it easier for users to authorize passes for various purposes.

Bullet points

  • Apple's PassKit framework is responsible for Apple Pay and managing user passes in the Wallet app.
  • Passes are digital representations of information typically found on paper or plastic cards.
  • Passes are created as packages with the extension .pass and consist of various components, including a pass.json file, a manifest.json file, and image assets.
  • Required fields for creating a pass include the pass type identifier, serial number, format version, team identifier, organization name, and description.
  • Passes can have different visual appearances, such as boardingPass, coupon, eventTicket, storeCard, and generic.
  • After creating, signing, and compressing a pass into a bundle, it can be distributed via email, file sharing options like iCloud or AirDrop, or using the Add to Wallet button provided by Apple.
  • Passes can now provide not only barcode information but also NFC data.
  • Passes can be used for various purposes, such as flight boarding, student ID, gym membership, or even a ticket for WWDC.

What is PassKit and how to use it?

Boarding Pass by Jordy Arntz

Apple PassKit framework is responsible for Apple Pay and managing user passes in the Wallet app.

This time let’s talk about passes, how to create and distribute them. Wallet app allows iOS users to organize boarding passes, tickets or gifts, business and loyalty cards. In short, passes are digital representations of information that usually is printed on paper or used as plastic cards.

Pass building blocks

Passes are created as packages (or bundles) with extension .pass and consists of:

  • pass.json - file that defines the pass, image assets, and other metadata;
  • manifest.json - file that describes files inside the pass and has SHA1 checksums of each of the files
  • image assets
  • background of the pass
  • logo — the logo in the pass header
  • icon — small icon for the pass
  • strip — image strip background behind the primary fields

Required fields creating a pass

When creating a pass you need to provide the pass type identifier and serial number. Type identifier is a String value using reverse DNS style — for example, pass.com.example.loyalty-card. Serial number is a string value that has a unique value in the scope of the pass type, like a membership number or a ticket identifier.

Other mandatory fields are:

  • format version — file format version, usually need to use 1 (number)
  • team identifier — unique 10-character identifier provided by Apple which you can find out from developer.apple.com portal
  • organization name — displayed on the lock screen
  • description — helps to make the pass accessible by VoiceOver

Different flavors of the pass

Passes can have different visual appearance:

  • boardingPass - pass for a flight, train, bus or any other type of transit
  • coupon - coupons, special offers or discounts
  • eventTicket - pass to enter any kind of event
  • storeCard - loyalty card style
  • generic - style appropriate for any pass

Wallet app is using different layout to each of these styles. It is much easier for your users to distinguish passes and find the right one faster.

Creating passes

Creating a pass is the first step of the pass lifecycle. It happens on the server side and should be cryptographically signed and compressed. The signing process requires several steps and Apple has a manual or you can use a third-party library and provide necessary certificates. By signing your passes your users can be sure that the pass is correct and not fake.

When you debug passes in the iOS Simulator Wallet app you can see any errors in the system log which you can view in Console app.

Distributing passes

After creating, signing and compressing a pass into a bundle you can distribute it in several ways:

  • sending with an email;
  • using file sharing options like iCloud or AirDrop;
  • using Add to Wallet button provided by Apple.

Using passes

Now you can provide not only barcode information but NFC data as well. When using NFC your users can simply hold the authorized device near the NFC reader and authorize the pass regardless — whether it’s a flight boarding, student ID, gym membership or even a ticket for the WWDC.

TL;DR

Apple PassKit framework helps to create, distribute and manage passes that usually are printed on paper or plastic.

It is a secure way to provide a more modern way to your users using Wallet app on their iPhones or Apple Watches.

Links

iOS
Passkit
Swift
Wallet App
iOS App Development
Recommended from ReadMedium