I have triple checked the certificates and it seems my issue may lie in the format being output by the php-passbook library.
Error message via the console when tethered:
Dec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: Invalid data error reading pass PASS-TYPE-IDENTIFIER/6731247236. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
Dec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: PassBook Pass download failed: The pass cannot be read because it isn’t valid.
Implementation:
// Create an event ticket
$pass = new EventTicket($event['Order']['transaction_id'], $event['Event']['EventDetail']['visible_name']);
$pass->setBackgroundColor('rgb(60, 65, 76)');
$pass->setLogoText('LOGO');
// Create pass structure
$structure = new Structure();
// Add primary field
$primary = new Field('event', $event['Event']['EventDetail']['visible_name']);
$primary->setLabel('Event');
$structure->addPrimaryField($primary);
// Add secondary field
$secondary = new Field('location', 'LOCATION');
$secondary->setLabel('Location');
$structure->addSecondaryField($secondary);
// Add auxiliary field
$auxiliary = new Field('datetime', '2015-01-27 @10:25');
$auxiliary->setLabel('Date & Time');
$structure->addAuxiliaryField($auxiliary);
// Add icon image
$icon = new Image(APP . 'webroot' . DS . '/img/logo_growtix_admin_lg.png', 'icon');
$pass->addImage($icon);
// Set pass structure
$pass->setStructure($structure);
// Add barcode
$barcode = new Barcode(Barcode::TYPE_QR, $key);
$pass->setBarcode($barcode);
// Create pass factory instance
$factory = new PassFactory('PASS-TYPE-IDENTIFIER', 'TEAM-IDENTIFIER', 'ORGANIZATION-NAME', APP . 'Vendor' . DS . 'Passbook/certs/PASS.p12', '', APP . 'Vendor' . DS . 'Passbook/certs/AppleWWDRCA.pem');
$factory->setOutputPath(APP . 'webroot/passbook_passes' . DS);
$factory->package($pass);
$this->redirect('/passbook_passes/'.$event['Order']['transaction_id'].'.pkpass');
And the resulting JSON:
{
"eventTicket": {
"primaryFields": [
{
"key": "event",
"value": "Event Name",
"label": "Event"
}
],
"secondaryFields": [
{
"key": "location",
"value": "The Salt Palace",
"label": "Location"
}
],
"auxiliaryFields": [
{
"key": "datetime",
"value": "2015-12-08T13:00-08:00",
"label": "Date & Time"
}
]
},
"serialNumber": "6731247236_5069_1913",
"description": "Test",
"formatVersion": 1,
"barcode": {
"format": "PKBarcodeFormatQR",
"message": "test",
"messageEncoding": "iso-8859-1"
},
"backgroundColor": "rgb(60, 65, 76)",
"logoText": "GrowTix",
"passTypeIdentifier": "PASS-TYPE-IDENTIFIER",
"teamIdentifier": "TEAM-IDENTIFIER",
"organizationName": "ORGANIZATION-NAME"
}
The problem is due to the passTypeIdentifier
and teamIdentifier
keys.
This line in the log shows that you are using 'PASS-TYPE-IDENTIFIER' as your passTypeIdentifier
Key.
Dec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: Invalid data error reading pass PASS-TYPE-IDENTIFIER/6731247236. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
You should be using the certificate Pass Type ID, E.g. pass.com.passkit.admin
as your passType Identifier. This needs to match the Pass Type ID / User ID shown on the certificate.
Your teamIdentifier
needs to match the Organizational Unit in the certificate. E.g. U4LNY2SS5N
.
If you are using a Mac, you can see these details by using the quick preview (space bar) in Finder.