I have implemented passbooks and updating. I'm using the eo/passbook-bundle
and have created below JSON when packaging the passbook without errors, but when, in the update process, the server calls the webServiceURL/version/passes/passTypeIdentifier/serialNumber
api, and the device downloads exactly the same JSON (but not packaged, just this json), it fails.
I've read in a comment on Received invalid pass data while updating Apple Wallet Pass that it may have something to do with correct headers, but there's no description whatsoever in the docs on any specific headers to return in the response (see https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html)
I'm using symfony to return the response with the encoded json like this:
$json = PassFactory::serialize($storecard);
return new Response($json, 200, ['Content-Type' => 'application/json']);
I've also tried it without the Content-Type header.
In the log I can see: Get pass task (pass type pass.com.spinpos.latest.customercard, serial number 5, if-modified-since (null); with web service url https://my.domain.com/api/loy/wallet/) encountered error: Received invalid pass data (The pass cannot be read because it isn’t valid.)
The JSON response is this:
{
"storeCard":{
"headerFields":[
{
"key":"prepaid",
"value":"0,00",
"label":"PREPAID"
}
],
"secondaryFields":[
{
"key":"username",
"value":"Some Name",
"label":"GEBRUIKERSNAAM"
},
{
"key":"lastvisit",
"value":"niet bekend",
"label":"LAATSTE BEZOEK"
}
],
"auxiliaryFields":[
{
"key":"qrcode",
"value":"2690310109104",
"label":"QR CODE"
},
{
"key":"points",
"value":20,
"label":"LOYALTY PUNTEN"
}
],
"backFields":[
{
"key":"website",
"value":"http://www.somesite.com",
"label":"WEBSITE"
},
{
"key":"phone_number",
"value":"05311223344",
"label":"TELEFOONNUMMER"
},
{
"key":"terms_of_service",
"value":"Dit zijn test algemene voorwaarden!",
"label":"ALGEMENE VOORWAARDEN"
}
]
},
"serialNumber":"5",
"description":"Your Customer card",
"formatVersion":1,
"locations":[
{
"latitude":51.62,
"longitude":5.55,
"relevantText":"Some Loc 2"
},
{
"latitude":51.7737967,
"longitude":5.5513203,
"relevantText":"Some loc 1"
},
{
"latitude":52.2648569,
"longitude":6.8018085,
"relevantText":"Testdfdr"
}
],
"barcode":{
"format":"PKBarcodeFormatQR",
"message":"2690310109104",
"messageEncoding":"iso-8859-1"
},
"barcodes":[
{
"format":"PKBarcodeFormatQR",
"message":"2690310109104",
"messageEncoding":"iso-8859-1"
}
],
"backgroundColor":"rgb(255,108,108)",
"foregroundColor":"rgb(46,14,170)",
"labelColor":"rgb(110,255,75)",
"authenticationToken":"048cfd30e4baf1c3250f0c8c7500f998aee2da49",
"webServiceURL":"https://my.domain.com/api/loy/wallet/"
}
Anyone any idea what's wrong with the JSON or the headers?