Search code examples
javaandroidandroid-pay

How to open "save to android pay" url from android app?


Now I'm in the following situation: our server sends ready-for-use JWT hash for current user card, but there are seems to no way to open "save to android pay" url from android app button: there are only web applications integration tutorial: https://developers.google.com/save-to-android-pay/reference/s2w-reference So, I have to some way render this html: <g:savetoandroidpay jwt="JWT" onsuccess="successHandler" onfailure="failureHandler" /> into button and handle javascript callbacks from Java. Or, maybe, there are some another way?


Solution

  • Uri androidPayUri = Uri.parse("https://www.android.com/payapp/savetoandroidpay/" + jwt);
    Intent intent = new Intent(Intent.ACTION_VIEW, androidPayUri);
    

    ...

    Here you can find an example JWT to test:

    https://developers.google.com/save-to-android-pay/reference/s2w-reference