Apple Wallet Integration with Node.js and pkpass

Picture of Anshuman Chhapolia
Anshuman Chhapolia

Introduction

Apple Wallet (PassKit) enables users to store event tickets, passes, and boarding passes directly on their iPhones for instant access. In this guide, we’ll cover how to integrate Apple Wallet into your Node.js application using .pkpass files and the passkit-generator package.

We’ll go step by step: from setting up certificates in Apple Developer Portal to generating passes and delivering them to users.

How Apple Wallet Passes Work

An Apple Wallet pass (.pkpass) is simply a zipped bundle containing:

  • pass.json — metadata (event info, barcodes, colors)
  • Images (icon, logo, strip, background)
  • manifest.json — list of files with hashes
  • signature — signed with your Apple certificate

Apple PassKit Package Format Reference

📷 Diagram Idea: PassKit bundle structure (folders + files).


Step 1: Create a Pass Type ID and Certificate

  1. Log in to Apple Developer Account.
  2. Create a Pass Type ID
    • Go to Certificates, Identifiers & Profiles → Identifiers → Pass Type IDs
    • Click ➕ Add
    • Enter a description (e.g., Event Tickets)
    • Enter an identifier (e.g., com.yourcompany.eventtickets)
    • Save
  3. Create a Certificate for the Pass Type ID
    • Go to Certificates in the Developer portal
    • Select Pass Type ID → choose the one you created
    • Click Create Certificate
    • Generate a Certificate Signing Request (CSR) from your Mac:
      openssl req -new -newkey rsa:2048 -nodes -keyout pass.key -out pass.csr
    • Upload the CSR to Apple Developer portal
    • Download the generated certificate (.cer)
  4.  Export Certificate to .p12 Format
    1. Double-click the downloaded .cer to install into Keychain Access
    2. Find it in Keychain Access → My Certificates
    3. Right-click → Export → Save as .p12
    4. Set a password (you’ll use this in Node.js)
  5. Download the Apple WWDR Certificate
    1. Download from Apple Worldwide Developer Relations Certificate
    2. Convert it to .pem format:
      openssl x509 -in AppleWWDRCAG3.cer -inform DER -out wwdr.pem -outform PEM

At this point, you have:

  • pass.p12 → Pass Type Certificate (with password)
  • wwdr.pem → Apple WWDR certificate
  • pass.key → private key

These will be used to sign your passes in Node.js.

📷 Screenshot Idea: Apple Developer portal showing Pass Type ID and certificate creation.

Step 2: Install Dependencies

We’ll use passkit-generator.

npm install passkit-generator

Step 3: Create a Pass in Node.js

 
				
					import {
    PKPass
} from "passkit-generator";
import fs from "fs";
// Load certificates
const cert = fs.readFileSync("./certs/pass.p12");
const wwdr = fs.readFileSync("./certs/wwdr.pem");
const password = "your-cert-password";
// Create pass
const pass = new PKPass({
    model: "./eventPass", // folder containing pass.json + images
    certificates: {
        wwdr,
        signerCert: cert,
        signerKeyPassphrase: password,
    },
}, {
    serialNumber: "TICKET12345",
    description: "Concert Ticket",
});


// Add details
pass.fields.primaryFields.add("event", "Concert Night", "Gate Opens 7 PM");
pass.fields.secondaryFields.add("venue", "Sunshine Arena");

// Add QR code 
pass.setBarcodes({
    message: "TICKET12345",
    format: "PKBarcodeFormatQR",
});
// Save pass 
fs.writeFileSync("event-ticket.pkpass", pass.getAsBuffer());
				
			

Apple Pass JSON Keys Reference

Step 4: Deliver the Pass to Users

  • Serve .pkpass via download link or email attachment.
  • On iOS → “Add to Wallet” prompt appears.
  • On Android → Gmail/Chrome detect .pkpass and allow opening.

Distributing Passes

📷 Diagram Idea: Flow of Backend → User Download → Add to Wallet.

Step 5: Validate and Test

  • Use Apple’s Pass Validator to check correctness.
  • Test on multiple iOS devices and versions.

Conclusion

By creating a Pass Type ID and certificates in the Apple Developer portal, then generating .pkpass files in Node.js, you can integrate Apple Wallet support into your ticketing system and deliver a seamless user experience.

Recent Articles

How We Reduced Event Entry Wait Times with Apple Wallet Integration
Advanced Full-Text Search in PostgreSQL: Beyond Simple Pattern Matching
Why Stacked Cards Just Work Better Than Lists for “Next Task” Views