Passbook: inside a pass

Related posts about Passbook:


After introducing Passbook here, this post will show what is really a passbook pass.

A passbook pass is just a compressed file, a .zip archive, but with a “.pkpass” extension. This compressed pass must be cryptographically signed.

Zip to pass

The .pkpass includes 3 necessary files:

  • manifest.json
    The manifest is a JSON file that lists the archives in the .pkpass, calculate the SHA-1 hash of their content and store the hash in a dictionary. The manifest file itself and the signature file are not included. An example of the manifest file content is:

    {"pass.json":"41ea636799de90475196cdf17f879653aa256e61",
    "icon.png":"7bec35c1b3f926c50df1bbc6a7a62870cdd47aea",
    "icon@2x.png":"a3603d48dfb142efa86577b4143c06c94d77b087"}
  • pass.json
    A JSON dictionary that defines the pass. It describes the type of pass and the content of its fields. The JSON structure is described in detail in the Apple developer library.
  • signature
    This file is a detached PKCS #7 signature of the manifest file. The signature is created using the private key associated with our signing certificate and using the WWDR intermediate certificate. The Worldwide Developer Relations (WWDR) certificate can be downloaded from here.

The zip archive also contains the images of the pass. The images are included inside the pass using standard names as we will see in another post.

To support localization, the structure of the .pkpass archive changes. For each supported location, it is necessary to create a subfolder to separate the files that depend on the location. For example create a subfolder named “es.lproj” and create a strings file named “pass.strings” that contains the Spanish strings. These strings will be referenced from the pass.

The directory structure:
Structure

Read More

Introduction to Passbook

Related posts about Passbook:


Passbook is an application included in iOS 6 which allows a user to store tickets or passes. These passes can be downloaded from other applications, from the browser or from the email. They have a front space to show the most important data and a back space to show some details and additional options.

Passbook is not available for iPad.

Back options

On the back of some passes, the user can activate the “Show On Lock Screen” option. This option will show the pass in the lockscreen at a specific hour or location. The option “Automatic Updates” will update the pass automatically without any user interaction.

In order to provide this options to our users, we need to have implemented an Apple Push Notification Service.

Types of passes

There are 5 types of passes:

  • Boarding Pass. This pass style is appropriate for passes used with transit systems such as train tickets, airline boarding passes, and other types of transit.
  • Event ticket. This pass style is appropriate for passes used to gain entry to an event like a concert, a movie, a play, or a sporting event.
  • Store Cards. This pass style is appropriate for store loyalty cards, discount cards, points cards, and gift cards.
  • Coupons. This pass style is appropriate for coupons, special offers, and other discounts.
  • Generic. This pass style is appropriate for any pass that doesn’t fit into one of the other more specific styles.

Source: mashable.com via Kate on Pinterest

Barcodes

Passes contain barcodes that can be scanned to display their information. Passbook supports the following 2D barcode formats: QR, Aztec and PDF417. Next to the barcode image, we can add a text label to make the barcode human-readable in case it could not be scanned.

Best Practices

In the Passbook Programming Guide, there are some recommendations to take into account when designing and creating our passes. I highlight the following best practices:

  • Add a link to your application in the back of the pass.
  • Use an alternative text to the barcode.
  • Create policies regarding when passes can be redeemed. Remember that these policies are your responsability: control duplicates and expiration dates.
  • On the front space, the contents of fields must be brief. Show the rest of the information on the back of the pass.

Passes in Android

There are some applications in Google Play that import and store Passbook passes, so Android users can choose between different options.
One of the best is PassWallet from Attido Mobile (PassWallet – Passbook + NFC).

Read More