How to create your own wallet passes (pkpass)

Before we get started

  • Boarding pass- transit systems such as train tickets, airline boarding passes, and other types of transit.
  • Coupon- special offers, and other discounts.
  • Event ticket- gain entry to an event like a concert, a movie, a play, or a sporting event.
  • Generic- any pass that doesn’t fit into one of the other more specific styles for example, gym membership cards, coat-check claim tickets, and metro passes that carry a balance.
  • Store card- loyalty cards, discount cards, points cards, and gift cards.

Prerequisites:

  • MacOS — in order to create “Apple Worldwide Developer relations Certification Authority” (WWDR).
  • Basic knowledge of command line.

Create everything you’ll need

Create Request Certificate

  • Open the keychain app on your macOS machine.
  • Click on Keychain access > Certificate assistant > Request a Certificate From a Certificate Authority
  • Fill in email address and select save to disk.
  • Click on continue and save. (.certSigningRequest)

Create Identifier

  • Go to identifiers > create an identifier by clicking on the plus sign.
  • Select Pass Type IDs > Click on continue.
  • Fill in Description and a unique identifier (pass.com.{{company_name}}.{{project_name}} > Click on register.
  • Select your registered pass identifier in list > Click on Create Certificate.
  • Fill in your Pass certificate Name > Upload .certSigningRequest certificate from previous step. > Click continue.

Create Certificate

  • Download the created certificate (.cer)
  • Double click and open in Keychain app > My Certificates > Click on relevant certificate > Export Pass Type ID:… > Save in .p12 format.
  • Choose a password (This is your export password).

Create a pkpass by command line:

  • Create a pass certificate with openssl and pkcs12 hashing type
  • The Path to .p12 certificate (created in the previous step) goes as input.
  • The output will be the private key which will be stored in a .pem file
  • Replace <import password> with your export password.

Create a pass key with the following command

  • The Path to .p12 certificate (created in the previous step) goes as input.
  • Replace <import password> with your export password.
  • Replace <key password> with a new key password (This will be your key password).

Last steps

Export WWDR certificate

  • In the Keychain access app > Certificates tab > Right click on the “Apple Worldwide Developer relations Certification Authority” (a.k.a WWDR)
  • Export “Apple ….” > Save as .pem file and rename it WWDR.pem (for convenience).

Define the information in your pass in the pass.json file

  • passTypeIdentifier key should have the value of your pass type id (starts with pass.com…)
  • teamIdetifier key should be filled in, value can be found in the Apple developer account on the top right corner under your name.

Create your company icon

  • Save as icon.png and logo.png

Create your thumbnail

  • Save as thumbnail.png

Create a manifest.json file

  • Add all file names as keys
  • Add hash value for each file by doing the following:

Create a signature by running the following command

  • Add the paths to the following files: passcertificate.pem, passkey.pem, WWDR.pem and manifest.json.
  • Establish this by zipping all of the following files, including the signature that we’ve previously created.
  • Replace <wallet pass name> with the name of the allet pass you wish to create.

Create a pkpass via python:

An example of a generic wallet pass:

An example of a boarding pass wallet pass:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store