// 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 = stripslashes($_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->setWWDRcertPath('../../../AppleWWDR.pem'); $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", "value": "' . $balance . '"