PassKit - Getting the Latest Version of a Pass - Response
<p>Reading the Apple PassKit documentation <a href="https://developer.apple.com/library/ios/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988" rel="nofollow">here</a>  or <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1" rel="nofollow">here</a>
 in the section titled "Getting the Latest Version of a Pass" or "Devices Ask for Latest Version of Passes" the two documents above simply suggest... </p>

<blockquote>
  <p>respond with a 200 and a payload of the data pass</p>
</blockquote>

<p>or </p>

<blockquote>
  <p>Your server returns the pass data or the HTTP status 304 Not Modified if the pass hasn’t changed. Support the If-Modified-Since caching mechanism on this endpoint.</p>
</blockquote>

<p>I'm assuming this is asking me to send the .pkpass file? With any headers? I feel I need to send some headers but the documentation isn't clear as to which ones?</p>

<p>I don't want to send a 304, in this instance as there is an update.
The domain has a valid SSL cert.</p>

<p>I'm using express to send the response and I've tried a few responses such as ..</p>

<pre><code>app.get('/passUpdate/v1/passes/*', function(req, res){
    console.log('Getting the Latest Version of a Pass');
    var path  = req.path;
    var parts = path.split("/");
    var deviceLibraryIdentifier = parts[4];
    var passTypeIdentifier = parts[5];
    var authorization = req.headers.authorization;
    var file = __dirname + '/public/pass/mytest.pkpass';
    res.setHeader('Content-type', 'application/vnd.apple.pkpass');
    res.setHeader('Last-Modified', 'Mon, 03 Apr 2016 19:01:35 GMT');
        //res.download(file);
        //res.attachment(file);
    res.sendFile(file);
        // res.attachment(https://www.mywebsite.com/pass/mytest.pkpass);
        // res.sendfile(https://www.mywebsite.com/pass/mytest.pkpass);
        // res.download(https://www.mywebsite.com/pass/mytest.pkpass);
    res.sendStatus(200);
    console.log(res.headersSent);
}); 
</code></pre>

<p>But the pass keeps making this request to the web service and on the phone at the top of the pass it reports "Couldn't Update Pass".</p>

<p>on a side note if i do respond with a 304</p>

<pre><code>res.sendStatus(304);
</code></pre>

<p>the pass then displays the message "updated yesterday"</p>

<p>But I do want to update the pass! And its not clear what I should send, as you can see from the commented sections above I have tried more than a few thing.</p>

<p>Any ideas or pointers are most welcome!</p>