简体   繁体   中英

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?

I found the "email link" way to do this, it can be used for Android app too:

addToAndroidPay.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.android.com/payapp/savetoandroidpay/" + token));
                    startActivity(intent);
                }
            });
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM