Generate a pkpass file for Apple Wallet
An Apple Wallet pass is a .pkpass file: a signed ZIP archive the iPhone opens and adds to the Wallet. You can generate one yourself. Running it in production (signing, certificates, updates, notifications) takes a real server. This guide covers both paths.
What a .pkpass file contains
| File | Role |
|---|---|
pass.json | The pass description: style, fields, colors, barcode, identifiers |
icon.png (+ @2x, @3x) | Required: icon shown in notifications and on the lock screen |
logo.png, strip.png, thumbnail.png… | Optional images, depending on the pass style |
manifest.json | The SHA-1 hash of every file in the archive |
signature | The detached PKCS #7 signature of manifest.json |
The style is set in pass.json with a single key: storeCard (loyalty card), coupon, eventTicket, boardingPass or generic.
Doing it yourself: the steps
- Join the Apple Developer Program (paid membership) and create a Pass Type ID (
pass.com.yourbrand.loyalty). - Generate the certificate for that Pass Type ID and export it with its private key. Also download Apple's WWDR intermediate certificate.
- Write
pass.jsonwith at leastformatVersion,passTypeIdentifier,serialNumber,teamIdentifier,organizationName,descriptionand the style key. - Compute
manifest.json: the SHA-1 of every file, image by image. - Sign the manifest with the certificate and the WWDR, and write the result to
signature. - Zip everything and serve it with the
application/vnd.apple.pkpassMIME type.
The certificate expires: renew it before the deadline, or no pass can be installed any more.
The hard part: updates
A .pkpass is frozen. For a points balance or a boarding gate to change on the iPhone, you need to:
- set
webServiceURLandauthenticationTokeninpass.json; - run a web service that registers devices, lists updated passes and returns the new version of a pass;
- send an APNs notification to every affected device, with the Pass Type ID certificate;
- regenerate and re-sign the pass on every change.
And all of that for the iPhone only: Android needs a separate integration, see Integrate the Google Wallet API.
With eldo wallet
eldo wallet generates and signs the .pkpass files, registers devices and pushes updates. You never handle a certificate, a manifest or APNs. Passes are signed with the eldo wallet certificate: no Apple Developer account needed (large accounts can use their own). See Apple Wallet vs Google Wallet.
| Doing it yourself | With the eldo wallet API |
|---|---|
| Join the Apple Developer Program ($99/year) | Not needed: eldo wallet signs with its own certificate |
Write pass.json and the images | Set up the card once: PATCH/store-cards |
| Sign and zip one pass per customer | Create the customer: POST/clients |
| Host the file, handle iPhone and Android separately | One add link (shortLink) for Apple Wallet and Google Wallet |
| Web service + APNs for every update | Update the customer: PATCH/clients/{id}/gain |
| Renew certificates | Nothing to do |
To get started: the quickstart creates a loyalty card and sends it to a customer in three calls.