[T-Mobile LG G5 Guides, News, & Discussion] waylo:
Android Pay use after rooting has been discussed in a few other threads, here on XDA, notably the 6P and 5X Nexi:

http://xdaforums.com/nexus-6p/general/android-pay-root-t3309072

http://xdaforums.com/nexus-5x/general/passing-safetynet-root-t3307659

With our newly rooted H830s (courtesy of http://xdaforums.com/tmobile-lg-g5/development/root-h830-t3384526), it'd be nice to collect our information here.

I am very interested in how Android Pay may or may not work after our TOT flash. Here's a quick tutorial:

SuperSU must install via a 'systemless' root method due to security changes with Marshmallow. Thus, when SuperSU is flashed in TWRP as described in the TOT root thread, it can only install this way. It should not affect the /system partition.

Android Pay uses the "Safetynet API" to detect for tampering/root. What they classify as tampering is not entirely clear. But they do check /system among other things. It looks like apps that have altered the /system partition in some way are detected via this method.

(more boring info here http://www.howtogeek.com/241012/saf...y-and-other-apps-dont-work-on-rooted-devices/ )

It must also check the permissions of the /su/bin folder, as it should have a 751 permission profile (which is the described fix in the TOT root original post).

That is:

-Run "adb shell"

-From the shell run "su"

-On the # prompt run "chmod 751 /su/bin/"

Or, you can use root explorer to change the permissions octal to 751 for that folder.

It is set to this permission state in the rooted TOT upon first install. Obviously other root alterations you do may change it.

There are apps, such as Safetynet Helper sample (https://play.google.com/store/apps/details?id=com.scottyab.safetynet.sample), which can utilize the API to see if the API is tripped.

Right after installing the TOT and getting everything to boot properly, the app shows everything is still kosher. I was able to run Android Pay, add credit cards, and have confirmed with a payment transaction.

I believe any root app that doesn't make permanent changes to /system in and of itself will probably keep Android Pay working. Obviously, for instance, if you have a terminal program app with root, and run some commands that alter your system partition/files, it may trip SafetyNet, though just having the app installed does not.

EDIT1: As of 7/25/16, a change was made to the SafetyNet API and it now detects systemless root. Android Pay no longer works on rooted devices, regardless of method. A new method will need to be developed.

EDIT2: As of 8/22/16, a workaround has been developed and tested!​

Developer [MENTION=4470081]topjohnwu[/MENTION] has created Magisk (http://xdaforums.com/android/software/mod-magisk-v1-universal-systemless-t3432382). This is a new way of integrating systemless changes into Android devices. This includes root, xposed, etc. The unique thing with Magisk is that you can instantly un-root your device, run Android Pay, and then reactivate root, all without rebooting. It is pretty seamless.

See the referenced thread for the latest information. It does take some work to install but it's fairly straightforward.

If you want to start from a clean install, [MENTION=4131622]Gungrave223[/MENTION] has detailed the steps here:

http://xdaforums.com/showpost.php?p=68353051&postcount=22

If you want to keep your data, it's just slightly more work. Assuming you are starting with a rooted install, here is a quick summary on how to do this:

0. You may want to first un-register the cards you have in Android Pay. Some banks apparently only allow a set # of installs before they block additional installs, thus requiring you to call the bank directly to have them reset that number. If Android Pay resets (unsure what security changes trigger this), it will forget your cards, thus leaving those cards registered on a phantom install. Un-registering first may prevent this.

1. Get the Magisk flashable zip, the Magisk-altered phh-superuser.zip, and the Magisk manager apk from the referenced thread.

2. Go to SuperSU and select full unroot. DO NOT restore the stock boot.img. DO NOT restore the default recovery. The phone should reboot and your root will be lost.

3. You should now restore the stock boot.img. This can be done without losing your data or re-encrypting your data. There are 2 ways.

Flash autoprime's stock boot.img zip file through TWRP (recommended), OR

Flash the TWRP-ed TOT file through LGUP, using the UPGRADE (not refurbish) setting

Why not just allow SuperSU to restore the stock boot.img in step 2? Because it will reboot instantly into system and start encrypting your data, with no way for you to intervene and boot into TWRP first!

4. You likely did not have data encryption on your initial rooted installation. If you want to keep yourself un-encrypted, you MUST immediately boot into TWRP before the next power on. If you do not, it will re-encrypt your data. This is the default behavior of the stock boot partition, which you just restored in the step above. You can make this easy for yourself by TWRP flashing autoprime's stock boot.zip and then immediately doing the next steps. Note: Magisk can be installed just fine on a phone with an encrypted data partition if you don't care about data encryption.

Flash the magisk.zip from the Magisk thread. This installs Magisk and also disables the forced encryption (just like the dm-verity zip)

Re-establish root by then flashing the special modified phh-superuser.zip

Note: Chainfire's SuperSU is NOT compatible if you want to use Android Pay

5. Reboot into system. You need to then install from the Playstore phh's superuser app. You also need to install the Magisk manager apk. Grant all your usual apps root permission in the superuser app.

6. Run Magisk Manager and grant it superuser access. You'll find a simple toggle to mount/unmount root. Unmount! Check that SafetyNet will pass. If you've done everything right, it will!

7. Run Android Pay. Add your card(s) back. Mount root back and go about your business.

8. When you want to use Android Pay, unmount root and run the app. Here's a tricky part (and currently a work in progress). We do not know how often or when Android Pay checks for root. We DO know that it does this when you initiate adding a new card. So you can try an Android Pay transaction. If it fails (they often do, even if you are unmounted root at that time), pretend to add a card, cancel it, and then do the transaction again. It should work now!