Add links to your Transit pass

There are four ways to add links to a transit pass.

  • Use TransitClass.LinksModuleData to add links to all transit passes that are associated with the TransitClass.
  • Use TransitObject.LinksModuleData to add a link to a specific transit pass TransitObject.
  • Use TransitObject.appLinkData to place an app link at the bottom of that particular Pass.
  • Use TransitClass.appLinkData to place an app link at the bottom of all the passes of that class.

One benefit of app linking is that it empowers your call-to-action to navigate users to your branded experiences from Google Wallet. Links with this feature appear at the bottom of the Pass.

App Applink Data Example Web Applink Data Example

For a given transit pass, set the field TransitObject.appLinkData to the URI or Package name of your app or website.

See the format and context of the appLinkData field in the following source code:

  {
    "id": string,
    "classId": string,
    …
    …
    …
    "appLinkData": {
      "androidAppLinkInfo": {
        "appTarget": {
          "packageName": "com.google.android.gm",
        }
      },
      "webAppLinkInfo": {
        "appTarget": {
           "targetUri": {
              "uri": "https://mail.google.com/mail/",
              "description": "Web link for Gmail"
           }
        }
     }
    }
  }
For posterity the following implementation will also work.
{
  "id": string,
  "classId": string,
  …
  …
  …
  "appLinkData": {
    "androidAppLinkInfo": {
      "appTarget": {
        "targetUri": {
          "uri": "https://play.google.com/store/apps/details?id=com.google.android.gm",
            "description": "Play store link for Gmail app"
        }
      }
    }
  }
}