yashsingh1/xdaforums huggingface dataset:
[Magisk] jcmm11:
drop_attest is only if you want to revert the triggers for some reason. You shouldn't be applying that if you want to try and leave everything as RW.
[Magisk] dardack:
Oh I misread that then. Thank yoiu for clearing this up for me.

EDIT: Changed Cmod 660 to dg.db, rebooted, ran attest.sql. Still can't add cards. Looks like I can pay, just not add without it read only.
[Magisk] jcmm11:
You mentioned that pay set attest to 10 at some point. If you hadn't applied drop_attest this shouldn't have happened. By applying drop you remove the logic that keeps attest at 0.

FYI I, currently, have no good way to test all this so anything you do along those lines is appreciated. I do know that theoretically it should work. If it does work then, going forward, updates etc should not be an issue (again, unless Google changes the table structures. Highly unlikely but not totally impossible).

(If you applied drop you can just reapply attest.sql to put things back)
[Magisk] dardack:
I did, but Like i stated in my edit, unless I made dg.db read only, I can't add new cards. No clue why tho. So now I add, then take off read only and go forward for now.
[Magisk] jcmm11:
Hmm. Curious. Not sure why that would be the case, especially since setting it to 440 does allow you to add cards. That seems counter-intuitive. Not sure if it's solvable without access to Google's code. Might just be something to live with.
[Magisk] dardack:
Yeah i'm hoping it only needs to be read only for adding cards, and going forward read/write is fine for paying. I've changed it back to 660 for now since I"ve added all 6 cards now testing.
[Magisk] Nosferatu.:
I guess so. That other guy's method worked. If you think I can help in assisting the group here considering how mine continues to work I'll be happy to provide a log or something.

I had one failure yesterday at best buy but just used it today at CVS and it continues to work. That was my only payment failure. I was able to follow it up with a successful payment. Since I last posted I upgraded to pay 2.88.248 from 2.88.246. Also updated to Magisk 19.2 and Manager 7.2.
[Magisk] dardack:
That's crazy to me. If I just take away the sql fixes, it immediately let's me know can't use phone in store. What phone? I have a pixel 3 so no clue if stock google has slight differences for detecting, shrug.
[Magisk] GryphonBR:
I actually use a Termux script with embedded SQL commands, because then I created a widget from Termux:Widget and now, yeah, it's manual but just a touch away. TBH, I find this a better solution then constantly having it checked and patched, since it seems unnecessary because the aforementioned method allowed me to add cards while also using any cards for payment.
[Magisk] Nosferatu.:
OnePlus 6T stock ROM rooted with Magisk.
[Magisk] Tr4sHCr4fT:
Termux sqlite3 package is also pretty neat together with tsu, even supports readline. (Tab and arrowkeys)
[Magisk] c3k:
anyone get it working on samsung s10 series?

I did the same configuration that worked on s8 (core mode, manager hidden, hide from pay & gms) but isn't working, even after cleaning the db follow BostonDan/jcmm11's script. The big difference between devices is GPay version (2.74 vs 2.88), is there a way to reinstall the old one and block autoupdate?

EDIT: I restored the 2.74 app from a S8 TitaniumBackup (apk only) and is working. As on previous device luckly is not appearing in Play Store updates, don't know why.
[Magisk] dardack:
So how does this work for you. You leave dg.db write/read. You touch every reboot? Everytime you want to pay/add a card? I would be interested in this potentially.
[Magisk] GryphonBR:
It actually works great. I made it into a script simply because, in case of GPS updates, I can simply run a widget; I actually ran the script once, left dg.db write-only, and have been able to both add cards and make payments without any problems so far. Oh, and I haven't had to touch it again since the one time - as I said, I made it into a script only for future convenience, essentially.
[Magisk] dardack:
Interesting, can't add cards unless read only. Oh well, at least it's something. Thanks for the info.
[Magisk] dwane3:
Where to put and how to run this script? Please full manual and files..
[Magisk] Nekromantik:
So I used the script and kept dbr/w and was working fine on paying but then it keeps saying try again.

Tried in 3 different places and it wont work.

its not the usual you cant use your phone to pay message instead it just says try again but never works.
[Magisk] GryphonBR:
It was the same for me. I'm guessing the DB is updated automatically when it's r/w, so there's that.

I'm curious nonetheless - why would you rather have it r/w?
[Magisk] dardack:
Cause in 6 months or w/e when GSM wants to update, I'll probably forget what i need to do to make it work.
[Magisk] GryphonBR:
Hehehehehe, fair enough... Guess that's yet another reason I've made the script, it'll make things easier for me in the future.

In any case, I guess that if you do make db.dg r/w then it'll eventually update the attestations (GSM update or not) and then you'll end up losing GPay functionality, ain't that the case?
[Magisk] dardack:
Yeah I mean the script is nice, I have the sql script myself. But if you don' t have to make it Read only to add cards, you are ahead of me.

As for r/w, if I leave it as long as I dont' add cards, it seems fine and I dont' loose GPAY. Even when the card adding tells me, you can't use this card to pay in store, if I close/open gpay my cards are listed for payment (granted I wasnt' near a terminal to test). Last time when that happened, as soon as it went to can't pay in store adding a card, all cards were removed from my list to pay in store and I had to add them again (before the sql script, downgrading services to 16 and pay).
[Magisk] Nekromantik:
No one else have problems with it keeps saying re-try when paying in store?
[Magisk] GryphonBR:
I left it as read-only. I was able to add a brand new card to GPay and use the added cards without any concerns - besides, the past couple of times I had the "can't pay in store" message (which were before the SQL patching), the cards were still available on GPay, but I never found a solution before where I could simply keep GPay as was. If it happens again, I'll update this.

Not sure which process have you followed, but I have not gotten any similar message. After patching db.dg I've had no issues using the cards I have configured on GPay.
[Magisk] cubemario:
Many thanks

Finally my Pixel 3(JP Model w/ May Update and Magisk 19.0) could add cards.
[Magisk] Nekromantik:
I used the script method to set the values to 0.
[Magisk] Fry-kun:
Applied this to my phone, but Pay still doesn't let me set up a card to use in store. Is there a step I'm missing other than applying the sql commands?

I've verified with sqlite3 that the fields are updated as per script.
[Magisk] hanneshoch3:
Try setting it read-only, that's the only way it works for me as well. Neither the script nor manual changes do the trick without it being read-only. Make sure to have set the fields to 0 before you make it r/o. However, sometimes the terminal still declines the card after some time, even though gpay says it worked fine. Then I have to remove gms folder and do the same procedure again so I can setup PayPal again.
[Magisk] jcmm11:
Some feedback seems to say that setting dg.db RO allowed you to add cards. Feedback also states you can change it back to RW after adding the cards
[Magisk] Xx-Ness-xX:
In your script:

CREATE TRIGGER IF NOT EXISTS fails_attestation_update AFTER UPDATE OF fails_attestation

ON Wallets WHEN (NEW.fails_attestation <> 0)

isn't the bold font supposed to be OLD?

P.S. I don't know much about sql programming but I am just trying to make sense out of it

Thanks,
[Magisk] irony_delerium:
Nope. It's checking the updated row (alias NEW), not the original row (which would be OLD). If GMS sets Wallets.fails_attestation to anything non-zero, the trigger executes after the update statement is finished.
[Magisk] Clark789:
Hi,

yesterday at first with Magisk 19.0 (OP3T, stock OOS 5.0.8) my payment with Google Pay didn't want to work. After i have made an update to Magisk 19.2, it worked without any issues. Just for information...

Regards

Clark
[Magisk] GryphonBR:
Still don't know which script you're referring to, since there are at least two solutions floating around: one that has a longer SQL script, and AFAIK keeps dg.db R/W, and another that should be somewhat shorter and sets dg.db RO. I use the latter with a Termux script I adapted to allow for a widget creation through Termux:Widget and I've had no issues using GPay - I received an update for the app yesterday but was still able to make a purchase without hiccups last night.
[Magisk] Nekromantik:
I used the longer SQLscript that keeps db file RW.

one quoted above by people.
[Magisk] GryphonBR:
That might just be the issue; I haven't used the one keeping dg.db R/W and I have not had any problems since using the alternate script that keeps it RO.

If you want, here's a copy of the script I'm currently using, and as an extra piece of info I have SQlite installed from Termux:

am force-stop /data/data/com.google.android.apps.walletnfcrel
chmod 777 /data/data/com.google.android.gms/databases/dg.db
/sbin/sqlite3 /data/data/com.google.android.gms/databases/dg.db "update main set c='0' where a like '%attest%';"
chmod 440 /data/data/com.google.android.gms/databases/dg.db
[Magisk] Nekromantik:
will try that thanks
[Magisk] dardack:
So just after having a few days to test in store and what not. The attest.sql works great for setting the 0, but doesnt' seem to fix the trigger issue or some other issue. dg.db NEEDS to be Read only for adding cards and for in store payment. It had worked once for me as r/w but went to another store and kept getting error trying to pay, changed to r/o boom worked right away same terminal/store/card. Shrug.
[Magisk] dimon222:
attest.sql + this = works on my Huawei Mate 20 Pro :good:
[Magisk] Itachisasuke:
Has anyone thought about turning the above scripts into a Magisk module that monitors one of the lines and runs automatically?
[Magisk] jsylvia007:
So I ran the attest.sql file from a root terminal. It appears to have applied. I then opened up Google Pay, and tapped "Set up in-store payments" on one of my cards. I was met with: "Couldn't finish setup to pay in stores -- This phone can't be used to pay in stores. This may be because it is rooted or altered in some way."

Is there something else that needs to be done in Magisk? Attestation now shows 0, so that's a plus.
[Magisk] dimon222:
Probably harder since it means monitoring Sqlite 24/7. However, the patch creating triggers can theoretically be incorporated in Magisk module. Not sure if it fits philosophy of Magisk tho, since its mainly dealing with non-modifying of such data.

Check my post couple of messages up, chmods are required as well.
[Magisk] jsylvia007:
So correct me if I'm wrong, BUT, the chmods prevent GMS, etc. from auto-updating, so I would need to be mindful of that, correct?
[Magisk] GryphonBR:
Exactly as I originally suggested, RO allows for it to work.

You don't need SQL plus the snippet I provided, it should be one or the other. So far, it seems keeping db.dg R/W as attest.sql does prevents GPay from working consistently.

That's a supposition, so far. I've yet to see anything clearly stating that from a factual point of view.
[Magisk] jsylvia007:
Confirming that all I needed to do was apply your script and I was able to add the cards successfully. Before applying I removed the SQL stuff. Won't be able to pay for a bit, but will test as soon as I can.
[Magisk] GryphonBR:
You removed the SQL stuff because you had already used the attest.sql previously, right? If not, you won't be able to use GPay anyway - the SQL commands in the script are shared are needed to get GPay to a work state, then the permission change to dg.db is necessary to ensure the changes are persistent.
[Magisk] jsylvia007:
Correct. I had already used attest.sql and then you said in a post above that you either need one method or the other, not both. So I ran the file to remove what attest.sql had done and then created a script out of your commands and ran those.
[Magisk] GryphonBR:
Yep, that's right. But, in all fairness, keeping the SQL commands on the script I shared wouldn't hurt in this case - you'd just be rerunning a similar set of instructions.
[Magisk] jsylvia007:
Sounds good! Looks like maybe we're on our way to a long-term "solution".
[Magisk] mcflyrk01:
dumb question but you just ran attest.sql, right? the second file is to undo it?

nevermind that was correct, i got it! just had to make sure to chmod 777 first and chmod 440 after running
[Magisk] CSX321:
Hmm. Mine was working fine (using either SQL script technique), but it just failed. Now I get "Try that again!" when I try to pay. Well it was fun while it lasted. Back to using my watch.
[Magisk] ledhed:
Will Google Pay work on a WearOS watch even if you get the "rooted" error on your phone??? I've purposely not bought a watch thinking there would be no point.
[Magisk] CSX321:
Yes, no problem. WearOS 2.0 devices are basically standalone, so it works fine so long as you don't root the watch itself.
[Magisk] crows:
Hi is there anyway to fool the google play service that its already at its latest version so it doesn't update? i.e. install an older version that works but sign it or whatever you have to do to make it think its the latest version.

I remember doing this for another app, made the revision number few versions higher than what was the real version.
[Magisk] mirxx:
Thanks mate. Your solution worked perfectly. Added cards successfully. :victory:
[Magisk] ledhed:
That's amazing! But how do you add cards using the watch?
[Magisk] CSX321:
It uses an app on the phone, but I haven't had any problem doing that, even when I couldn't use Pay on the phone because it's rooted.
[Magisk] ledhed:
I get the rooted error when I try to add cards. I guess the watch wouldn't work for me either then. FML
[Magisk] CSX321:
No it's a different app. It will work.
[Magisk] ledhed:
What app?
[Magisk] CSX321:
I think it must be a part of the WearOS app on the phone. The watch kind of uses the phone screen for some interface stuff while you're setting up Pay on the watch. So even with Magisk on my phone and unable to add cards there or use Pay there, I can still add cards and use Pay on my watch (Fossil Sport) with no problem at all.
[Magisk] nomisunrider:
Kind of off topic, but how do you make a termux widget run under sudo or as root?
[Magisk] ckegg:
Run your terminal app and do command "su" to grant root access
[Magisk] nomisunrider:
That's for a terminal, not a widget. I got around that with this:

https://gitlab.com/st42/termux-sudo/blob/master/sudo

Another note. It should be

/system/bin/am

The one in termux doesn't support force-stop apparently.

However now I'm finding other problems with that...
[Magisk] GryphonBR:
No problem, glad to hear it worked!

You need to have Termux:Widget installed, then I also installed SQLite3 using

apt install sqlite

and then finally I have a second script under ~/.shortcuts/

su -c '/data/data/com.termux/files/home/script.sh'

which points to the original script I shared. Finally, you go to whatever home screen you use and add a widget from Termux:Widget; you should essentially have two options, one that's kind of a list showing all available scripts under .shortcuts (more akin to a widget, as a matter of fact) and another that would allow you to create shortcuts to the script directly - and, in this case, the extra script should be under ~/.shortcuts/tasks instead, but this part might actually be better explained on Termux's Wiki.

It's not exactly that straightforward, depending on what exactly you're trying to accomplish.

Yeah, the original script is indeed for a terminal; I never said it was supposed to be for a widget but instead that I created a widget using that script as a base - the full procedure is on the above quote. Also, you're partially wrong about the am command; the issue is not that Termux doesn't support force-stop but rather that this instruction is available only to the root, not to users. You can even try that out yourself: install sqlite on Termux, then move to an elevated terminal and run the script. I guarantee it'll work.

Last but not least, you mention running into other problems using termux-sudo; you're probably running into the same issues I did (because I actually tried not only that sudo, TBH) and I ended up sorting it all out using the aforementioned method. YMMV, surely, but so far this method works perfectly for me and allows me to have working GPay without any issues.
[Magisk] nomisunrider:
Fun note. Nacho notch will prevent google pay from adding a card. You get this message:

"Looks like another app is blocking access to the wallet, Turn off any apps that might be drawing over the screen and try again"

Just disable it hiding the notch.
[Magisk] Cowbell_Guy:
I am on the pixel 2XL, and I'm still unable to use Google pay with the latest version
[Magisk] Actipode:
I get permission denied trying to use this script after having followed the instructions in the repo (Termux, Magisk 19.2, Android 9 on Pixel 3). Regular "su -" works as expected.

Did you do any steps other than those by author to make it work?
[Magisk] herobrine_second:
Confused, is Google Pay finally working with MagiskHide as of today?
[Magisk] Itachisasuke:
Not without workarounds and scripts that directly modify the attestation fields that Google Pay is setting for detecting root.

So Magisk is not natively working with Google Pay at this time. User and Script Intervention is required for functionality.
[Magisk] dvhttn:
It was for months on my S7 running Pie (search for my posts about this). No scripts, just hid GP from Magisk and used it ..... So, before going down the scripts route, just test it out and see.

Oh, and GP and Google Play Services were all updated to the latest ones, no preventing updates.
[Magisk] cineq:
I've been using gps 17.4.55 updated manually from built in in xiaomi.eu on mi mix 2. Two latest versions of xiaomi.eu and no problems with adding cards nor paying in shops (3 payments during a week). Attest values 10. Magisk 19.2 and all gps and Google pay hidden. Previously using first xiaomi.eu pie for mi mix 2 and previous gps update I couldn't pay (no reaction on phone and terminal). Workaround with attest was not working for me. I clean installed latest gps 16.x version and disabled it's auto updates using titanium backup. Then payments were possible without any further hacks. The same as now with 17.4.55.
[Magisk] Nosferatu.:
Yes.

I've been using it for months. Search back in this thread. I'm on 17.4.55. No SQL or hacking. Letting it update GPay and Play Services at will.

I'm here on vacation in Hawaii just did 2 quick point of sales no hiccups. See screenshot.
[Magisk] exovision:
No. Not working for me.

No scripts tried yet.

Pixel 2 xl, GPS 17.x, Magisk 19.2.

Will Magisk have an update to allow this soon?
[Magisk] the_boo:
So I was just able to add PayPal to google pay and use it fine... Pixel 2xl latest stable magisk, latest gpay services...

I'm far too lazy for scripts so I went to see if the PayPal app had it's own nfc payment, it does not but it does have an "add to google pay" option in settings. I hid root from PayPal and added to google pay, it opened up my Google pay app bringing up the same setup pages that you would get adding it straight through Gpay but low and behold I didn't get the rooted message. Used it for a payment at a vending machine right after and it worked perfectly...

Right before this I tried to add paypal straight through Google pay and no dice... Also unsure if it is necessary to hide root from PayPal but I figured it couldn't hurt and I'm not gonna try unhiding it lmao
[Magisk] Hubird:
I don't have much experience with Rooting and Android pay.

The only thing I use root for is AdAway.

If I install a custom ROM on a Nexus 6P, root it, install AdAway, set up the adblocking then disable root with gpay work without issue?

Or is it the unlocked bootloader that that is the problem?
[Magisk] hhspiny:
works for me

This worked for me on Galaxy Note 9. saved the script as .sh and ran it in FX Explorer's own script execution tool. very convenient.
[Magisk] exovision:
This might be a noob question but are you saying you can run the script direct from your phone?

If so, how do you save it as a .sh.

FX explorer's script execution tool?

Thanks.
[Magisk] GryphonBR:
Not sure which author you're referring to, as for permission denied I would suspect this has to do with the location where you put the script. For it to work, before logging as root I put the script on ~/ and I've had no issues so far.

For GPay to work, in this case, bootloader unlocked would be an issue. Besides, whichever ad blocking method you use will require occasional updates, so setting it up once and leaving it to that would eventually lead to having ads again. Last but not least, if you're using Magisk, AdAway currently defaults to systemless ad blocking, so once you disable Magisk you'd lose ad blocking completely.

There might be more then one way, but what I do is install Termux (or you could use any other terminal emulator, for that matter) and run the script from there like Linux.
[Magisk] exovision:
Ok, I have Termux installed now. Do I just run the code copied straight from this page?

am force-stop /data/data/com.google.android.apps.walletnfcrel
chmod 777 /data/data/com.google.android.gms/databases/dg.db
/sbin/sqlite3 /data/data/com.google.android.gms/databases/dg.db "update main set c='0' where a like '%attest%';"
chmod 440 /data/data/com.google.android.gms/databases/dg.db

Or do you need to save the code as .sh first? Is ~/ the top level of the device? Using FX is that "Main Storage" or "System"

What is "update main set c='0' where a like '%attest%';" ?

Thanks :)
[Magisk] Gido5731:
Any scripts for the Pixel 3xl?
[Magisk] Lessaj:
The script posted just above from [MENTION=4062470]GryphonBR[/MENTION] worked for me on the Pixel 3XL, I ran it and rebooted and was able to activate my card. Only difference for me is I'm not using sqlite from Termux, I'm using the magisk module version so I changed /sbin/sqlite3 to just sqlite3, it's already in $PATH, and I run it from Tasker on device boot and shutdown.
[Magisk] GryphonBR:
Don't get me wrong, but you don't sound very bash savvy; am I right in such assumption?

At any rate, my instructions were for running it from Termux, so you'd need to first save it as a script (so .sh) and then run it from there. ~/ is the home directory for any given user - for regular user in Termux, that's the default directory where it's installed. No idea how that would translate to FX since I've never used it.

Finally, the code you asked about is a SQL command.

As [MENTION=4903174]Lessaj[/MENTION] said, this script is device agnostic. I'm running it on a Pixel 3, FWIW.

---------- Post added at 05:58 AM ---------- Previous post was at 05:55 AM ----------

Just FYI, you shouldn't need to run this code everytime (like boot and shutdown) since the script makes dg.db RO. No modifications should be inflicted on the file afterwards.
[Magisk] Lessaj:
Yes, but you never know. ;) Maybe an update will recreate it and then it's RW again.
[Magisk] GryphonBR:
Hahahahaha, fair enough. Better safe than sorry!

What I ended up doing was making the script into a shortcut so it's only a touch away in case of need.
[Magisk] Hastaloego:
tried today with magisk 19.2 on op5 running latest Havoc-OS and didn't work. i tried all those stuff mentioned here. i can install gpay, i can ass cards and paypal but when i put the phone on the scanner simple nothing happens at all. no error message, nothing. NFC does work, i tried with some nfc tags i have. but on gpay just nothing, no haptic feedback or anything at all.