<?php require 'PKPass.php'; $pass = new PKPass(); $pass->setCertificate('../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file) $pass->setCertificatePassword('test123'); // Set password for certificate $pass->setJSON('{ "passTypeIdentifier": "pass.com.apple.test", "formatVersion": 1, "organizationName": "Flight Express", "serialNumber": "123456", "teamIdentifier": "AGK5BZEN3E", "backgroundColor": "rgb(107,156,196)", "logoText": "Flight info", "boardingPass": { "primaryFields": [ { "key" : "origin", "label" : "San Francisco", "value" : "SFO" }, { "key" : "destination", "label" : "London", "value" : "LHR" } ], "secondaryFields": [ {
// User has filled in the card info, so create the pass now setlocale(LC_MONETARY, 'en_US'); require('../PKPass.php'); // Variables $id = rand(100000,999999) . '-' . rand(100,999) . '-' . rand(100,999); // Every card should have a unique serialNumber $balance = '$'.rand(0,30).'.'.rand(10,99); // Create random balance $name = $_POST['name']; // Create pass $pass = new PKPass(); $pass->setCertificate('../../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file) $pass->setCertificatePassword('test123'); // Set password for certificate $pass->setJSON('{ "passTypeIdentifier": "pass.com.apple.test", "formatVersion": 1, "organizationName": "Starbucks", "teamIdentifier": "AGK5BZEN3E", "serialNumber": "'.$id.'", "backgroundColor": "rgb(240,240,240)", "logoText": "Starbucks", "description": "Demo pass", "storeCard": { "secondaryFields": [ { "key": "balance", "label": "BALANCE",