Using PassEntry’s Download Page to Deliver Passes

When creating a pass, we return a JSON object with pass attributes and timestamps. Within this object, we include a downloadUrl, unique to each pass, which when clicked by the end user will open a generic pass download page, a web view hosted by PassEntry on download.passentry.com.

As at this stage, the passholder’s device type is unknown, one of the purposes of this download page is to detect the user’s device and deliver either an Apple Wallet pass or Google Wallet pass. When the download page is opened on a device other than an iPhone or Android phone, it will display a QR code directing the user to the same URL, in order to direct them to open the download page on a mobile device.

Using this download page enables simple distribution of passes to your customers via a generic, dynamic link. As a best practice, we suggest putting the downloadUrl behind a button or redirecting the user to it at a desired point in their user journey.

Customising the Download Page

You can customise your organisation’s pass download page via the PassEntry dashboard. Under the Pass download page tab, you’ll find options to upload brand-specific images, choose custom colours, and personalize text so the page closely aligns with your own platform.

Using ‘Direct’ Pass Source Delivery

In some cases, use of the download page is not a viable option, such as when provisioning the pass from within an app, or when wanting to directly deliver the pass from within a web page, without redirecting the user to PassEntry’s download page.

In order for this to be possible, you must know the device type when creating the pass. When delivering the pass from within an app, the device type will already be known. When delivering from a web page, there are a number of scripts that can be used to detect the device type and request the correct pass source.

Here is a sample script:

Fetching the device type
const getMobileOS = () => {
  const userAgent = navigator.userAgent || navigator.vendor || window.opera;
  if (/android/i.test(userAgent)) {
    return "Android";
  } else if (/iPhone/i.test(userAgent)) {
    return "iPhone";
  }
  return "Other";
};

// Example usage
const mobileOS = getMobileOS();
console.log(`This page is opened on: ${mobileOS}`);

Once the device is known, request and deliver the correct Pass Source. To request the Pass Source, include the ?includePassSource query parameter in your POST /passes/ or GET /passes/:id request. This parameter accepts apple or google as options. For more details, review the API documentation for these endpoints.

If valid, the response will include the pass attributes in JSON, alongside a passSource object. It will only return the passSource object in the response if the selected pass is not currently active in a device.

The passSource object will contain a key, googleDownloadUrl, containing a unique URL, which when opened on an Android device, will prompt the user to add their pass to their Google Wallet. As the Google Wallet is linked to an individual Google Account, the user will be prompted to log in to their Google Account if they are not already logged in and to download the Google Wallet if they have not already done so.

The googleDownloadUrl works best when placed behind Google’s “Add to Google Wallet” button. Here are the brand guidelines and assets provided by Google:

Add to Google Wallet

Was this page helpful?