0

I'm using the PassJS library to generate pkpass files using the following code:

 const pass = await PKPass.from(
            {
                model: path.resolve(
                    __dirname,
                    '../helpers/walletPasses/model.pass'
                ),
                certificates: {
                    wwdr: certificates.wwdr,
                    signerCert: certificates.signerCert,
                    signerKey: certificates.signerKey,
                    signerKeyPassphrase: certificates.signerKeyPassphrase,
                },
            },
            {
                // keys to be added or overridden
                
            }
        );

 const buffer = pass.getAsBuffer();
  const { dataURL, error } = await uploadPassToAWS(
        `${passGuid}.pkpass`,
        buffer
    );

This works great to generate the pass and upload it to AWS S3, returning a link I can use to download the pass.

However, now I'm trying to implement the apple webService APIs described here: https://developer.apple.com/library/archive/documentation/PassKit/Reference/PassKit_WebService/WebService.html

In particular, the following endpoint:

Getting the Latest Version of a Pass

GET request to webServiceURL/version/passes/passTypeIdentifier/serialNumber

Response

**If request is authorized, returns HTTP status 200 with a payload of the pass data.**

My understanding is that this endpoint expects the pass data to be returned in JSON format - how can I convert the pkpass generated using the code above to a JSON format I can return to Apple on this endpoint.

If it's meant to be the actual pkpass file, and not a JSON representation, how would I send that back as a response in express - would I be sending the buffer object in my code, or the URL to the updated pass on AWS?

Alk
  • 5,215
  • 8
  • 47
  • 116

0 Answers0