Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

  • Blog Navigation
Passbook for iOS 6

Passbook is an exciting new feature coming to iOS 6 which has endless possibilities. Creating a basic pass is extremely simple, yet there is much room for customization.

Passbook will be useful in many areas.  A “pass” is not necessarily a pass in the traditional sense, because it may represent a ticket, a coupon, a payment card, or a boarding pass. Some common uses include flight tickets, movie tickets, bus or train tickets, store coupons, or store payment cards. Anything which currently uses a barcode may be turned into a pass for Passbook.

A pass is essentially a JSON document containing several required values as well as allowing for plenty of custom fields. There are custom fields which allow you to add your own information to a pass which you are creating. For example, for a movie ticket, the name of the theatre at which the movie is playing. For each custom field you define, you may also define a string, called changeMessage, that will be displayed to the user whenever that field is changed. The changeMessage string may also contain a parameter %@ which will be replaced with the new value of the field.

For example, a changeMessage for “Your theatre has been changed to %@” might read as “Your theatre has been changed to 12” if a user’s pass was updated. In order to create an official pass, you must take your JSON file containing most of the pass info, pack it together with some images (logo, background, each with retina versions), a JSON file containing a hash of every file in the package, and a signature file containing a signed hash of all the files. You may optionally include localized versions of the strings and images in a subfolder.

Here’s an example JSON file for the simplest pass you can make (with no optional info filled in) :

{ "passTypeIdentifier":"", "formatVersion":1, "serialNumber":"123456", "description":"Boarding pass for April 4, San Francisco to London", "boardingPass":{ "transitType":"PKTransitTypeAir" } }

Once you have generated this package, you can serve it to an iOS 6 device through Mail or Safari and it will recognize it as a pass and read it into the Passbook app, providing the user with a prompt for adding it. You can also use the PKAddPassesViewController class by passing in a pass file which you have downloaded inside any app, which will have the same effect as serving it through Mail or Safari.

Once you have served a pass to the user, your server will receive a request which indicates that the user has accepted the pass. The server should record this new user and remember all the information about the pass they received. This way, later on, if the user asks for an update to their pass, or if you wish to push an update to them, you can remember all the information about that user and their pass, and should be able to generate a new pass with the changes you wanted, updating your records as well.

If a user deletes a pass associated with your server, it will receive a delete request, which you should record in order to stop sending that user pass updates. Also, a user can request a pass update at any time. By default, this will send a request to your server, however if the pass has not changed, your server should not serve out a new pass, or else the user can refresh their pass over and over and your server will be wasting resources.

This post has only briefly discussed all the Passbook possibilities and technicalities, but hopefully you have a better understanding about how Passbook passes are generated, and how you might set up a server to serve new passes and update existing passes.

Share This