0

I am trying to deep-link to a specific Google Pay pass on the Google pay app. For example, if the user taps on a link, they should be directly be redirected to pass installed on their Google Pay app.

Similarly I would also like to check if the pass is installed or not their phone and if the Google Pay app is installed on the phone as well.

This is all through React Native. Any kind of help or information is appreciated! Thanks.

lemonade
  • 11
  • 3

2 Answers2

0

Check if user has removed pass

GET https://walletobjects.googleapis.com/walletobjects/v1/loyaltyObject/objectId Source: https://developers.google.com/pay/passes/guides/implement-the-api/engage-users-through-google-pay?hl=en#determine-if-user-removed

Link to specific pass https://pay.google.com/gp/v/object/{}.{} Source: https://developers.google.com/pay/passes/guides/pass-verticals/use-cases?vertical=loyalty#link-to-saved-pass

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 17 '21 at 13:41
  • Thank you, but I am still unclear as to how to get the Object ID of the pass? – lemonade Nov 17 '21 at 21:16
  • Google Pay Business Console should tell you. If you are issuing your passes through a different service, you'll need to ask them to help you get the Object ID. – Alexis Miller Nov 17 '21 at 21:56
  • Do you have any reference to the actual implementation? I believe the Object IDs would be different between different mobiles and there should be a way of getting it, which is what I am trying to find. Thanks in advance – lemonade Nov 18 '21 at 09:35
0

I'm not familiar with React Native so I can't give you React Native specific answers but you may be able to adapt the following answers for React Native.

I am trying to deep-link to a specific Google Pay pass on the Google pay app. For example, if the user taps on a link, they should be directly be redirected to pass installed on their Google Pay app.

Similarly I would also like to check if the pass is installed or not their phone and if the Google Pay app is installed on the phone as well.

You can achieve this with a Save to Google Pay link and launching an intent with the save URI. See example:

activityBinding.content.saveButton.setOnClickListener {
  val uri = Uri.parse("https://pay.google.com/gp/v/save/$jwt")
  val intent = Intent(Intent.ACTION_VIEW, uri)
  startActivity(intent)
}

The handling of the intent typically has the following behaviors:

  • If Google Pay is available on the device, it can launch Google Pay
    • If the pass is already saved, it will show that the pass has already been saved with an option to remove or to view the pass
    • If the pass hasn't been saved, it will save it with the option to remove or view the pass
  • If Google Pay isn't available, it will open the link in a browser with similar saved/unsaved behavior above.

Using this approach you don't technically need to check to see if the pass has been saved, or if Google Pay is available. Note that passes can be saved even if the Google Pay app isn't installed.

If you'd like more information on how to generate a jwt, refer to https://developers.google.com/pay/passes/guides/implement-the-api/save-passes-to-google-pay?hl=en&feed=email-sms#generate-jwt-that-represents-object

There's also a Codelab available if you'd like a step by step guide which includes code samples on creating jwt with a nodejs backend.


If you must check to see if Google Pay is installed, you should be able to query it using this answer: https://stackoverflow.com/a/18752247/12031739

Note that the Google Pay package name may vary depending on region of the world you are in so you'll want to check which package name applies to you.

Soc
  • 7,425
  • 4
  • 13
  • 30
  • This still doesn't answer the question I have as this is to do with creating a new pass. I just want to be able to query and check if a particular pass/card exists or not. – lemonade Dec 15 '21 at 02:51