5

Actually I want to save an offer to 'Google Wallet'. As I haven't worked on it before I did some RND and came across this documentation. In this documentation they are creating Offer class object at Android side but, in my case the Offer class object is creating at our back-end server and I'm getting ready-made JWT token just by hitting one API to our back-end server, now using that JWT token I want to save the offer to the 'Google-Wallet'. Now my question is, is it possible? if Yes please tell me How? Also please let me know if I can provide more details so that you can understand my problem. Thank you

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Dnyanesh M
  • 1,349
  • 4
  • 18
  • 46

1 Answers1

3

I have been working on this at PassNinja. The most convenient method for your use case would be to use the JWT link and intent. Fill in your generated JWT and class ID: https://www.android.com/{classid}/savetoandroidpay/{jwt_generated}

Use an ACTION_VIEW intent to open the deep link from the Save to Google Pay button. Make sure that the button that triggers the intent uses the Brand guidelines.

Intent webIntent = new Intent(Intent.ACTION_VIEW,
        Uri.parse("https://www.android.com/payapp/savetoandroidpay/" + JWT));
context.startActivity(webIntent)`

For more info on deep links and Save to Google Pay, here is a video.

Scott Condron
  • 1,902
  • 16
  • 20
  • Thanks for the reply. Can you please tell me where I'll get the {classid} filed? I tried "https://www.android.com/payapp/savetoandroidpay/" + JWT) this url by replacing my JWT token but, I'm getting "Something wen't wrong. Please try again later" errron on web page. – Dnyanesh M Sep 07 '18 at 06:50
  • Assuming you have already created a Class, you should be able to find it in your Merchant Center. https://wallet.google.com/merchant/walletobjects/admin/accounts/ – Scott Condron Sep 07 '18 at 11:19
  • Thanks @Scott Condron I'll check and let you know. – Dnyanesh M Sep 07 '18 at 12:02
  • Hi Scott! I tried by replacing my 'class-id' and 'JWT' in below URL "https://www.android.com/{classid}/savetoandroidpay/{jwt_generated}" but, getting "404" error. I checked, the 'class-id' and 'JWT' I'm sending are correct. – Dnyanesh M Sep 10 '18 at 08:10
  • 1
    The URL is now `https://pay.google.com/gp/v/save/${jwt}`. You can find more information here : https://developers.google.com/pay/passes/guides/implement-the-api/save-passes-to-google-pay#add-link-to-email – Cyril Durand Oct 06 '20 at 19:10
  • Is there any way to get a success or error callback to determine if the user has actually saved the pass after launching the Intent? – Philipp Jahoda Nov 30 '20 at 12:45