• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Working: Magisk with Google Pay as of gms 17.1.22 on Pie

Search This thread

pershoot

Inactive Recognized Developer
Dec 1, 2008
7,969
4,339
works great, thank you (recents also work). fit needed to be cleared and re-init'd (wasn't working right); same with gmail (notifs weren't coming through).
 

fbxdadev

Member
Mar 29, 2012
48
9
Thank you, setting up a new contractless card worked, so expect it would work using it too!

A sql query would be useful if there was a command line sql editor (wich i am sure there is) ... Something along the lines of

Column C = 0 where column A matches "attest" in table main

Anyone with better sql skills could translate my pseudocode in an actual sql query :)
 

Actipode

Member
Nov 29, 2015
7
0
23
Seattle
am force-stop /data/data/com.google.android.apps.walletnfcrel
chmod 777 /data/data/com.google.android.gms/databases/dg.db
sqlite3 /data/data/com.google.android.gms/databases/dg.db "update main set c='0' where a like '%attest%';"
chmod 444 /data/data/com.google.android.gms/databases/dg.db

Thanks, these commands worked.

However, when i create a .sh script with the same commands and try to run that instead, it fails with "no such file or directory" error in regard to /data/data/com.google.android.gms/databases/dg.db.
The paths are absolute like quoted, the script is run as root, and again, these same commands do work when executed manually one by one. Do you guys have an idea why this might be happening?
 

lssong99

Senior Member
Jul 15, 2005
349
196
Thanks, these commands worked.

However, when i create a .sh script with the same commands and try to run that instead, it fails with "no such file or directory" error in regard to /data/data/com.google.android.gms/databases/dg.db.
The paths are absolute like quoted, the script is run as root, and again, these same commands do work when executed manually one by one. Do you guys have an idea why this might be happening?

Maybe you need to also add absolute path for sqlite3 binary. When running as script, path environment may not be passed to the script...
 

Actipode

Member
Nov 29, 2015
7
0
23
Seattle
Maybe you need to also add absolute path for sqlite3 binary. When running as script, path environment may not be passed to the script...

I should have mentioned, the quoted commands are not the exact ones. Here's my script:
Code:
/system/bin/am force-stop /data/data/com.google.android.apps.walletnfcrel
chmod 777 /data/data/com.google.android.gms/databases/dg.db
/data/data/com.termux/files/usr/bin/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
 

Mr Beardsly

Senior Member
Jun 21, 2017
98
217
Toronto
Hi all,

So after sucessful usage of @BostonDan tut and then trying script from @lssong99 I have packed it into zip and give it interface with Synapse.

1. Flash zip from link below.
2. Open Synapse ang give root privilage.
3. Press the button.
4. Reboot device.
5. Enjoy

If your kernel supports init.d you can uninstall Synapse with any system app remover.

init.d script with mod will be executed on every reboot

If your kernel doesnt support init.d you will need apply mod via Synapse after every update.

Download:

https://www.androidfilehost.com/?w=files&flid=294740

enjoy

Can you please let me know how to use this after flashing. The instructions are not confusing
 
  • Like
Reactions: denzel09

lssong99

Senior Member
Jul 15, 2005
349
196
Good insight, thanks! Does this apply even for executing the script in Termux?

Several possible issue:
1. The script (let's say foo.sh) needs to have x attribute (for test, just 'chmod 777 foo.sh' before try.)
2. When execute within Termux, please cd into the folder with foo.sh, then use './foo.sh' to execute. The './' is mandatory.

3. If use Termux's sqlite3 bin outside of Termux (like in Tasker), to resolve the dependcy issue, execute
'export LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib'
once in foo.sh before 1st use of sqlite3.

All above command should be issued without quote.

Hope this helps!
 
  • Like
Reactions: Tr4sHCr4fT

73sydney

Senior Member
Jul 21, 2018
1,917
1,678
Sydney
Google Pixel 2 XL
Magisk Method Gpay SQLite Fix.....

This post best viewed in a browser - theres lots of formatting which is lost (and the hide tags dont work) when viewed via XDA App/Labs - (thanks to @pndwal for making me aware of this)

Stats as of 18/8/2020 - 23,000+ downloads....um thats a lot..only once did i wish id charged $0.50 per download

General Notice:


15/09/2021


Its recommended to try the very latest version of Universal SafetyNet Fix by @kdrag0n
to try and pass SafetyNet, in the first instance, and then try Google Pay, as you *may* be still able to avoid using my module below. If that doesnt work, but Universal SafetyNet Fix works and gives you a pass in the SafetyNet check section of Magisk Manager, you will have at least satisfied that stage in the Preliminary Checks below for using the module.

As always, things can change, and so for Magisk related issues, be sure to also keep up to date wih the Magisk General thread as that is the place to get SafetyNet related answers....

06/09/2021

You *may* NEED to use this module again - read below!

Due to some google side server tomfudgery, some people are finding they again need to use the module with the newer release and (vvb2060) Alpha version of Magisk. I was going to retire this thing, but no...

If youve been living under a rock (or are otherwise a needy millennial that expects to be spoonfed everything), TopJohnWu, creator of Magisk has started to remove certain parts of Magisk due to his employment with Google,and to avoid an obvious conflict of interest. Notably MagiskHide is in the process of being removed (though currently stil able to be enabled via commandline - see last dozen or so pages of Magisk General thread for more info, and solutions - some of which may involve MagiskHide Props Config or other SafetyNet fixes by people like @Displax) and so people have reported where they had been able to have GPay working without the module, they now need it, even after fixing SafetyNet and MagiskHide issues stemming from the above mentioned Magisk changes. It is as it always has been very random and not always entirely device dependent. It may be a ROM prop issue or something else adding a level of spanner to things. For now, the best advice i can give you is to try passing SafetyNet and verify Google Play certification as always, including using the preliminary checks as just below in You *may* not need to use this module - read below! and then if you pass those checks, but GPay still fails, consider continuing on to the module below.

14/03/2021

You *may* not need to use this module - read below!

Back and able to test again, and able to confirm the experience of some others, who have reported not needing the module recently to have Google Pay working. No one is quite sure why this is, or how long it will last. No one will be more happy than i if we can retire the module. For those wanting to try the minimal non-module method, ive added the steps i took below:
  1. Open Magisk Manager and enable MagiskHide (Settings -> toggle MagiskHide on)
  2. Toggle Airplane mode on
  3. Clear data for Google Play Store and Google Play Service (Settings > All Apps (toggle Show System) the search for and clear data for these packages)
  4. Reboot
  5. Toggle Airplane mode off
  6. Check Google Play Store is certified (Google Play -> Settings, scroll to bottom)
  7. Open Magisk Manager - check Safetynet passes (If not try steps under Pre Installation Checks) - Note: Make sure you are using at least Magisk v23 for the internal SafteyNetCheck OR use this 3rd party app to check for SafetyNet: https://play.google.com/store/apps/details?id=com.scottyab.safetynet.sample
  8. Add card and test
If this fails for you, please continue on below for further steps in Pre Installation Checks to try passing safetynet (adding fingerprints), or to try the module....

9/3/2021

Good news, switched over to a bank which does not only Google Pay, buy Samsung Pay (which is handy as i have had an Active 2 for a while now and Samsung Pay is relatively easy to get working on a rooted phone), so i'll soon be back using my own module and be able to better test issues if and when they crop up.

29/12/2020

I have had to change cards/banks (due to the previous ones ATM eating my card, and not being able to get money out to eat/pay rent/buy food etc without the card - and my only option to travel into a head office ATM in the centre of COVID every time i need to get money out, no thanks) to my previous bank which doesnt do Google Pay (which is why i moved to the other bank). So for the forseeable future i will NOT be able to test Google Pay payments.

19/08/2020

Major update to the installation process, mainly adding a pre-installation checklist....hopefully doing some basic tests (CTS pass/fail and basic/hardware attestation) before trying to install the module. Its high time things were done this way and may head off a lot less posts, with repeating information. So as opposed to people just trying the module and finding out afterwards that they werent passing CTS etc, now people will be encouraged to pass CTS/attestation first, and given the info (hopefully correct and understandable) to troubleshoot/resolve that, before trying my module.

At time of writing there are two hacks to bypass googles crackdown on rooted devices and make CTS pass (primarily bypassed by setting a valid fingerprint (usually most useful on custom ROMS)), and the other hardware backed attestation, which can be forced to basic. Both workarounds may become invalid at any time by google.

There are no updates to the module itself at this time, all changes are only for new installs, so if you have the module installed and working, then you are unaffected


Changelog:

GPay SQLite Fix:

v2.4 9/3/2021


Changes to service.sh:
  • Fixed broken/mangled pipes that left the log file blank - dont ask me why
If you need logging (only useful if youre having an issue and want to troubleshoot) you can choose to install the new zip, or extract the service.sh from the zip and overwrite the one in /data/adb/modules/73sydney.gpay

v2.3 - 20/12/2020


Changes to service.sh:
  • setting variable runsql=1, as noted by @osm0sis it was missing and script expected it to be set
I had fixed this and just reuploaded the v2.2 zip file, lazy at the time i didnt increment the version or document it here or on github. Fixed now.

v2.2 - 28/03/2020

All changes due to MMT-EX upgrade to v1.5
  • changes to /common/functions.sh
  • /common/addon/Volume-Key-Selector/main.sh changed and renamed to /common/addon/Volume-Key-Selector/install.sh
Upgrade to this version is not necessary, changes only affect module install...


SQLite3 Universal Binaries:

v1.2 - 5/09/2021


- Changed module format over to Zackptg5's MM-Ext module format, in part due to the old module doing a check based on an obsolete magisk mirror path. That was partly used to determine whether a ROM had an xbin or bin directory. Zack's excellent module does this internally and so reduces the need for that test as well as not having to hardcode the magisk mirror path into the script for that test.

Previous module would have failed on more recent magisk versions...

v1.1 - 1/10/2020

- Added

mkdir -p $MODPATH/system/xbin

In response to report from XDA user @djjohnnyblaze that the sqlite binary wasnt getting copied on his device under Android 11

Recommended especially for those folks who have recently tried installing the Gpay SQLite Fix and find it reports it doesnt find the sqlite binary, that you thought was just installed by the SQLite3 Universal Binaries module!

Current users can also check if theyre unaffected by checking the contents of the /cache/payfixfirstrun.log file, if the sqlite binary hasnt been found by the module, it will show up here as:

SQLite3 binary not found, please install a SQLite3 binary, without this the fix *may* not work
I provide an SQLite3 Universal Binary Magisk Module, and links to SQLite3 binaries for other architectures
at https://forum.xda-developers.com/showpost.php?p=79643248&postcount=176


Requirements:

Magisk:

Magisk Manager version 23 or above
is highly desirable as the recent SafetyNet check function issue is fixed in v23 and above, especially for more recent devices. To avoid possible stability issues on some devices, It is recommended, at least for now, that you run stable Magisk (unless on a very recent device where ONLY a Canary version will run, or a Canary version includes a fix for a specific issue that affects you), but use Magisk Manager (Canary version).

If your magisk install process usually involves installing Magisk Manager, and then install Magisk via it, its suggested that once you install Magisk Manager (Canary version), that you change the Update Channel to Stable (unless on a very recent device, or a canary version includes a fix for a specific issue that affects you):

From Magisk Manager (Canary version):
  1. Click the settings icon (gear in top right)
  2. Scroll to Manager section
  3. Tap Update Channel, and set to Stable

An SQLite3 binary:
  • Ive just added an SQLite3 Universal Binaries module to my github and download links below
  • Other SQLite3 binary choices for other chipsets *may* be found on Magisk Repo
  • For arm64-v8a (aarch64) users, an SQLite binary is available from the Magisk Repo: SQLite for ARM aarch64 devices
  • For all/other architectures, theres also some provided here (untested by me): https://forum.xda-developers.com/general/general/binary-sqlite3-binary-android-pie-t3721530
  • Other compatible SQLite3 binaries tested and reported working are provided with termux and titanium backup - users of these apps do not require a separate SQLite3 binary....

And quite (very) possibly one or both of the following...

MagiskHide Props Config - MagiskHide Props Config allows most devices to take advantage of a hack to bypass googles crackdown on rooted devices. Excellent work by @Didgeridoohan.

This can potentially "fix" CTS passing - sometimes in conjunction with the Universal SafetyNet Fix below
  • Fingerprint: by spoofing a certified device by adding a valid fingerprint in props (most useful for custom ROMs, or stock ROMs for uncertified devices - Chinese ROMs etc)
MagiskHide Props Config is available from the official Magisk Repo. The Pre-Installation Checklist below will help you identify if you need to install and configure it.

Universal SafetyNet Fix - Universal SafetyNet Fix by @kdrag0n is a "universal fix for SafetyNet on devices with hardware attestation and unlocked bootloaders. It defeats both hardware attestation and the new SafetyNet CTS profile updates released on January 12, 2021. The only requirement is that you can pass basic attestation, which requires a valid combination of device and model names, build fingerprints, and security patch levels."

In short its now the preferred method of enabling users with hardware attestation to pass basic attesation, which MagiskHide Props Config offered before recent Google changes

Not currently on the repo, but available via github, via link in OP of linked thread.

Please note: The Uninversal Safetynet Fix is now soemtimes integrated into ROM's, please check your ROM doesnt already include it before installing it.


Pre Installation Checks (To proactively head off the common reasons the module will fail)

Check For Identified Conflicting Magisk Modules: (tracked by @pndwal)
  • SafetyPatch
  • FDE.AI
These modules should be removed prior to trying this module. Failure to remove = no support.


Check For EdXposed: (Steps/tips courtesy of @kevinwu128, via @pndwal)

Method:

In EdXposed Installer

  1. Enable Black/White list in EdXp Settings
  2. Blacklist Google Play Services in Black/White list
  3. Reboot
  4. Check SafetyNet status in Magisk Manager

In EdXposed Manager

  1. Enable App List Mode in Settings
  2. Blacklist Google Play Services in Application List
  3. Reboot
  4. Check SafetyNet status in Magisk Manager

If the above fails search the thread with the keyword "edXposed" for further tips


Check for ctsProfile (pass/fail) and/or evalType (basic/hardware) in Magisk Manager:

Opem Magisk Manager and tap check SafetyNet to do an attestation test, which apart from the usual basicIntegrity and ctsProfile tests, now provides a test showing how the attestation is generated/processed, evalType is either BASIC or Hardware

Please note that Google could change this at any time and force all devices to use hardware attestation, though its unlikely that they care about your Galaxy S4 that youre stubbornly hanging onto.......

Method:

To check open Magisk Manager and tap Check SafetyNet mid way down the opening screen

Based on the results, choose which path below to follow:

  • Result: ctsProfile of fail and evalType of Basic

    Solution: Install a FingerPrint via MagiskHide Props Config (thanks be to @Didgeridoohan)

    These are the simplified steps, for more info on fingerprints and patch levels read the doc or visit the MagiskHide Props Config thread

    Method To Install A Fingerprint:
    1. Install MagiskHide Props Config (from magisk repo)
    2. Check that MagiskHide is enabled in Magisk Manager:
      • Click the settings icon (gear in top right)
      • Scroll to Magisk section
      • Toggle MagiskHide on
    3. Reboot
    4. Open a terminal and type su (grant permissions when prompted)
    5. Type props
    6. Type 1
    7. Type f
    8. Type the number that matches your devices manufacturer
    9. Type the number that matches your devices model
    10. Type the number that matches your android version
    11. Type y
    12. Type e to exit
  • Test SafetyNet again via Magisk Manager, if all passes continue to Clear Play Store & Play Store Services Data & Check Play Store Certification below

    See here for more info: https://github.com/Magisk-Modules-R...ices-fingerprint-to-pass-the-ctsprofile-check

  • Result: ctsProfile of fail and evalType of Hardware
    • Install Universal SafetyNet Fix (thanks be to @kdrag0n), reboot and test SafetyNet again via Magisk Manager, if all passes continue to Clear Play Store & Play Store Services Data & Check Play Store Certification below, otherwise consider installing a fingerprint via MagiskHide Props Config (thanks be to @Didgeridoohan)
    • Method To Install A Fingerprint:
      1. Install MagiskHide Props Config and reboot
      2. Open a terminal and type su (grant permissions when prompted)
      3. Type props
      4. Type 1
      5. Type f
      6. Type the number that matches your devices manufacturer
      7. Type the number that matches your devices model
      8. Type the number that matches your android version
      9. Type y
      10. Type e to exit

      See here for more info:

      Spoofing fingerprints: https://github.com/Magisk-Modules-R...ices-fingerprint-to-pass-the-ctsprofile-check

    • Test SafetyNet again via Magisk Manager, if all passes continue to GPay SQLite Fix install below

      If the above fails, please post in the MagiskHide Props Config thread for best chance of success, please be aware that the ability to even attempt to trick the system as MagiskHide Props Config currently does may be shutdown by Google at any time


Clear Play Store & Play Store Services Data & Check Play Store Certification
  • Toggle Airplane Mode on
  • Clear data and cache of:
    • Google Play
    • Google Play Services
  • Usually this will be achieved by (exact steps and terminology may change per device or ROM):
    • Opening Settings
    • Going to Apps, choosing Show All Apps
    • Enabling Show System Apps via a menu option
    • Locating the app, tapping it and then finding Storage/Cache
    • Tapping Clear Data
  • Reboot (Best) and/or Toggle Airplane Mode off
  • Open Google Play Store, wait 5 minutes, go to Settings and check Certification at bottom

Assuming you pass CTS and evalType tests, and Google Play Store Certification above, its time for the module installation.....


Module Installation:

The module has its best possible chance of succeeding if done on a clean flash of your ROM

  1. Install an SQLite binary (see Downloads below)
  2. Reboot if the SQLite you've just added is supplied by a magisk module (via magisk manager), so its active, as its required for GPay SQLite Fix install script.
  3. Install Gpay SQLite Fix magisk module via magisk manager (see Downloads below)
  4. At end of GPay SQLite Fix magisk module install, exit magisk manager
  5. Add card to Google Pay
  6. Reboot for gpay.sh service script to do its thing

It *should* be that simple.


Upgrade process (version v1.6 and above):

- Uninstall previous version
- Reboot
- Install latest

Upgrade process (versions below 1.6:

Because the new version no longer uses chattr, for anyone using a verison older than v1.6, you will want to issue the following commands via a terminal to put /data/data/com.google.android.gms/databases/dg.db in its original state before installing the latest version:

Code:
su
chattr -i /data/data/com.google.android.gms/databases/dg.db

- Uninstall previous version
- Reboot
- Install latest


Uninstall:

1) Remove via Magisk Manager - all changes except packages hidden via MagiskHide and clearing the cache of Google Pay are reverted
2) Reboot


Known Issues:

Loyalty Cards/Passes: You risk the possibility of loss of loyalty or other cards in the Passes section of Google Pay if you choose to flash the module and clear the cache & storage of Google Pay. Any version from v2.0+ will warn users and allow users to skip the clearing of Google Pay cache and app storage. This will also come with a warning that it *may* make the module fail to do its job.


Downloads (hosted on my github):


To download the working module zip, please click on the release link for any of the files below (this will take you to the latest release), and then download the first zip file on the following page, not the source.zip file nor the source.tar.gz below...

To look over the code and contents in the module, use the repo link and either browse the code and contents online or download the zip from that page. If you download the zip from the repo link it will not work as a flashable magisk module....

Gpay Fixes Downloads:


repo: https://github.com/stylemessiah/GPay-SQLite-Fix
release: https://github.com/stylemessiah/GPay-SQLite-Fix/releases/latest

SQLite3 Binary Downloads:

Universal (hopefully):

SQLite3 Universal Binaries v1.1 (installs to /system/xbin if exists, otherwise /system/bin) here:
repo: https://github.com/stylemessiah/SQLite3-Universal-Binaries
release: https://github.com/stylemessiah/SQLite3-Universal-Binaries/releases/latest

[/QUOTE]
 
Last edited:

denzel09

Senior Member
Jun 28, 2009
4,241
879
Teheran
Sorry, i have a bit confused. I have a MI 9 SE, i use Magisk.
From magisk i use init.d module, busybox module (squlite is in system/xbin) and also SQLITE module.

I have already one script for zram in post-fs-data.d and init.d works well.

Now, which script i need to use ONLY for gpay fix? Sorry but i read all these pages and now i am more confused.

Ps. never installed Termux or Synapse.

Thanks for help
 

Senliast

Senior Member
Dec 31, 2014
92
29
After applying database hacks (setting read only), the notification after purchase doesn't arrive and g pay doesn't remember purchases in the app. What about you guys?
 

spaceman860

Senior Member
Jan 11, 2012
2,642
3,276

Attachments

  • Screenshot_20190601-164414.jpg
    Screenshot_20190601-164414.jpg
    88.1 KB · Views: 1,980

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Thanks for your response. Actually google pay is not available in my country but rather the bank app itself has a feature to enable mobile payment. For the sake of testing I just wiped the data on the bank app and set it up anew but didn't help unfortunately.

    Sorry, i assumed that the bank app would somehow be tied to Google Play as it is with every bank account ive ever had that ive used Google Pay with :)

    And youre in the Google Pay thread....

    If you like you can try (if using the a version of Magisk with MagiskHide still (its changed recently to a Deny List - let me know if you are using the Deny List recent versions and i can try and help you edit what im about to suggest to try it with some mods):

    Riru (download the file Riru-v.xxxx NOT Source): https://github.com/RikkaApps/Riru/releases/latest

    and

    my Riru-Momohider (mod which auto configures the config files) atatched to the post here: https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/page-2320#post-85187739

    Install Riru first via Magisk Manager, then reboot
    Then install Riru-Momohider (Mod) and reboot

    Test and see if it works

    These modules are what i use to keep Samsung Pay from sniffing root on my Pixel, and also helps with my banks official app...

    You can also try Riru-Unshare (https://github.com/vvb2060/riru-unshare/releases/latest) in place of Riru-Momohider, but not both at once....

    These Riru addons are designed to try and isolate apps from detection above what MagiskHide can do

    All mentioned modules are uninstallable/reversible as magisk modules
  • 244
    Ok. I tried this and it worked on gms 17.1.22, allowing one to add cards and pay in store. Warning YMMV, but this is the process I did to get this working. One caveat is that I suspect users will have to reverse some step if gms is updated and then reapply, but this still needs to be confirmed

    Without further ado, here is my process:

    1) download a SQL database editor. I used

    https://play.google.com/store/apps/details?id=com.tomminosoftware.sqliteeditor&hl=en_US

    2) download a terminal emulator program. I used terminus but any terminal emulator should work.

    3) make sure Google pay is forced close, if it is open.

    4) open SQL editor. Navigate to /data/data/com.google.android.gms/databases

    5) open dg.db

    6) change any value that lists "attest" in the name (first column) to 0 in the third column. Mine was showing a value of 10 in the third column for each of these values. (Column c for sqlite database editor I used)

    7) open the terminal emulator.

    8) get root access (su)

    9) cd /data/data/com.google.android.gms/databases

    10) type: chmod 440 dg.db
    This makes dg.db read only (for owner and group, and no access for world.)

    11) reboot

    I have Magisk 19.1 with GMS and Google Pay hidden. Also, I am using a custom kernel but others have reported using a stock kernel with this working.

    I suspect when gms is updated, one will have to go back to steps 10 and 11 and chmod 660 dg.db to allow new keys to be written to the database, and then go back and redo all these steps to reset the attestation values back to 0.

    If there is still an error, verify in sqlite database editor that all attest release keys values in dg.db are 0 when dg.db is read only (owner and group).

    Again, YMMV but this worked for me, so I give it back to the community now.

    Edit: people should know this by now, but GMS updates have not required any reapplication of this process.

    Edit2: After much time, it was determined that all one has to do is apply the chmod 440 to dg.db before launching google pay for the first time after clearing gms data. No need to change any keys in the dg.db file. If it does not work, you may have to clear gms (Google play services) before applying chmod.

    Cheers,
    B.D.
    119
    Magisk Method Gpay SQLite Fix.....

    This post best viewed in a browser - theres lots of formatting which is lost (and the hide tags dont work) when viewed via XDA App/Labs - (thanks to @pndwal for making me aware of this)

    Stats as of 18/8/2020 - 23,000+ downloads....um thats a lot..only once did i wish id charged $0.50 per download

    General Notice:


    15/09/2021


    Its recommended to try the very latest version of Universal SafetyNet Fix by @kdrag0n
    to try and pass SafetyNet, in the first instance, and then try Google Pay, as you *may* be still able to avoid using my module below. If that doesnt work, but Universal SafetyNet Fix works and gives you a pass in the SafetyNet check section of Magisk Manager, you will have at least satisfied that stage in the Preliminary Checks below for using the module.

    As always, things can change, and so for Magisk related issues, be sure to also keep up to date wih the Magisk General thread as that is the place to get SafetyNet related answers....

    06/09/2021

    You *may* NEED to use this module again - read below!

    Due to some google side server tomfudgery, some people are finding they again need to use the module with the newer release and (vvb2060) Alpha version of Magisk. I was going to retire this thing, but no...

    If youve been living under a rock (or are otherwise a needy millennial that expects to be spoonfed everything), TopJohnWu, creator of Magisk has started to remove certain parts of Magisk due to his employment with Google,and to avoid an obvious conflict of interest. Notably MagiskHide is in the process of being removed (though currently stil able to be enabled via commandline - see last dozen or so pages of Magisk General thread for more info, and solutions - some of which may involve MagiskHide Props Config or other SafetyNet fixes by people like @Displax) and so people have reported where they had been able to have GPay working without the module, they now need it, even after fixing SafetyNet and MagiskHide issues stemming from the above mentioned Magisk changes. It is as it always has been very random and not always entirely device dependent. It may be a ROM prop issue or something else adding a level of spanner to things. For now, the best advice i can give you is to try passing SafetyNet and verify Google Play certification as always, including using the preliminary checks as just below in You *may* not need to use this module - read below! and then if you pass those checks, but GPay still fails, consider continuing on to the module below.

    14/03/2021

    You *may* not need to use this module - read below!

    Back and able to test again, and able to confirm the experience of some others, who have reported not needing the module recently to have Google Pay working. No one is quite sure why this is, or how long it will last. No one will be more happy than i if we can retire the module. For those wanting to try the minimal non-module method, ive added the steps i took below:
    1. Open Magisk Manager and enable MagiskHide (Settings -> toggle MagiskHide on)
    2. Toggle Airplane mode on
    3. Clear data for Google Play Store and Google Play Service (Settings > All Apps (toggle Show System) the search for and clear data for these packages)
    4. Reboot
    5. Toggle Airplane mode off
    6. Check Google Play Store is certified (Google Play -> Settings, scroll to bottom)
    7. Open Magisk Manager - check Safetynet passes (If not try steps under Pre Installation Checks) - Note: Make sure you are using at least Magisk v23 for the internal SafteyNetCheck OR use this 3rd party app to check for SafetyNet: https://play.google.com/store/apps/details?id=com.scottyab.safetynet.sample
    8. Add card and test
    If this fails for you, please continue on below for further steps in Pre Installation Checks to try passing safetynet (adding fingerprints), or to try the module....

    9/3/2021

    Good news, switched over to a bank which does not only Google Pay, buy Samsung Pay (which is handy as i have had an Active 2 for a while now and Samsung Pay is relatively easy to get working on a rooted phone), so i'll soon be back using my own module and be able to better test issues if and when they crop up.

    29/12/2020

    I have had to change cards/banks (due to the previous ones ATM eating my card, and not being able to get money out to eat/pay rent/buy food etc without the card - and my only option to travel into a head office ATM in the centre of COVID every time i need to get money out, no thanks) to my previous bank which doesnt do Google Pay (which is why i moved to the other bank). So for the forseeable future i will NOT be able to test Google Pay payments.

    19/08/2020

    Major update to the installation process, mainly adding a pre-installation checklist....hopefully doing some basic tests (CTS pass/fail and basic/hardware attestation) before trying to install the module. Its high time things were done this way and may head off a lot less posts, with repeating information. So as opposed to people just trying the module and finding out afterwards that they werent passing CTS etc, now people will be encouraged to pass CTS/attestation first, and given the info (hopefully correct and understandable) to troubleshoot/resolve that, before trying my module.

    At time of writing there are two hacks to bypass googles crackdown on rooted devices and make CTS pass (primarily bypassed by setting a valid fingerprint (usually most useful on custom ROMS)), and the other hardware backed attestation, which can be forced to basic. Both workarounds may become invalid at any time by google.

    There are no updates to the module itself at this time, all changes are only for new installs, so if you have the module installed and working, then you are unaffected


    Changelog:

    GPay SQLite Fix:

    v2.4 9/3/2021


    Changes to service.sh:
    • Fixed broken/mangled pipes that left the log file blank - dont ask me why
    If you need logging (only useful if youre having an issue and want to troubleshoot) you can choose to install the new zip, or extract the service.sh from the zip and overwrite the one in /data/adb/modules/73sydney.gpay

    v2.3 - 20/12/2020


    Changes to service.sh:
    • setting variable runsql=1, as noted by @osm0sis it was missing and script expected it to be set
    I had fixed this and just reuploaded the v2.2 zip file, lazy at the time i didnt increment the version or document it here or on github. Fixed now.

    v2.2 - 28/03/2020

    All changes due to MMT-EX upgrade to v1.5
    • changes to /common/functions.sh
    • /common/addon/Volume-Key-Selector/main.sh changed and renamed to /common/addon/Volume-Key-Selector/install.sh
    Upgrade to this version is not necessary, changes only affect module install...


    SQLite3 Universal Binaries:

    v1.2 - 5/09/2021


    - Changed module format over to Zackptg5's MM-Ext module format, in part due to the old module doing a check based on an obsolete magisk mirror path. That was partly used to determine whether a ROM had an xbin or bin directory. Zack's excellent module does this internally and so reduces the need for that test as well as not having to hardcode the magisk mirror path into the script for that test.

    Previous module would have failed on more recent magisk versions...

    v1.1 - 1/10/2020

    - Added

    mkdir -p $MODPATH/system/xbin

    In response to report from XDA user @djjohnnyblaze that the sqlite binary wasnt getting copied on his device under Android 11

    Recommended especially for those folks who have recently tried installing the Gpay SQLite Fix and find it reports it doesnt find the sqlite binary, that you thought was just installed by the SQLite3 Universal Binaries module!

    Current users can also check if theyre unaffected by checking the contents of the /cache/payfixfirstrun.log file, if the sqlite binary hasnt been found by the module, it will show up here as:

    SQLite3 binary not found, please install a SQLite3 binary, without this the fix *may* not work
    I provide an SQLite3 Universal Binary Magisk Module, and links to SQLite3 binaries for other architectures
    at https://forum.xda-developers.com/showpost.php?p=79643248&postcount=176


    Requirements:

    Magisk:

    Magisk Manager version 23 or above
    is highly desirable as the recent SafetyNet check function issue is fixed in v23 and above, especially for more recent devices. To avoid possible stability issues on some devices, It is recommended, at least for now, that you run stable Magisk (unless on a very recent device where ONLY a Canary version will run, or a Canary version includes a fix for a specific issue that affects you), but use Magisk Manager (Canary version).

    If your magisk install process usually involves installing Magisk Manager, and then install Magisk via it, its suggested that once you install Magisk Manager (Canary version), that you change the Update Channel to Stable (unless on a very recent device, or a canary version includes a fix for a specific issue that affects you):

    From Magisk Manager (Canary version):
    1. Click the settings icon (gear in top right)
    2. Scroll to Manager section
    3. Tap Update Channel, and set to Stable

    An SQLite3 binary:
    • Ive just added an SQLite3 Universal Binaries module to my github and download links below
    • Other SQLite3 binary choices for other chipsets *may* be found on Magisk Repo
    • For arm64-v8a (aarch64) users, an SQLite binary is available from the Magisk Repo: SQLite for ARM aarch64 devices
    • For all/other architectures, theres also some provided here (untested by me): https://forum.xda-developers.com/general/general/binary-sqlite3-binary-android-pie-t3721530
    • Other compatible SQLite3 binaries tested and reported working are provided with termux and titanium backup - users of these apps do not require a separate SQLite3 binary....

    And quite (very) possibly one or both of the following...

    MagiskHide Props Config - MagiskHide Props Config allows most devices to take advantage of a hack to bypass googles crackdown on rooted devices. Excellent work by @Didgeridoohan.

    This can potentially "fix" CTS passing - sometimes in conjunction with the Universal SafetyNet Fix below
    • Fingerprint: by spoofing a certified device by adding a valid fingerprint in props (most useful for custom ROMs, or stock ROMs for uncertified devices - Chinese ROMs etc)
    MagiskHide Props Config is available from the official Magisk Repo. The Pre-Installation Checklist below will help you identify if you need to install and configure it.

    Universal SafetyNet Fix - Universal SafetyNet Fix by @kdrag0n is a "universal fix for SafetyNet on devices with hardware attestation and unlocked bootloaders. It defeats both hardware attestation and the new SafetyNet CTS profile updates released on January 12, 2021. The only requirement is that you can pass basic attestation, which requires a valid combination of device and model names, build fingerprints, and security patch levels."

    In short its now the preferred method of enabling users with hardware attestation to pass basic attesation, which MagiskHide Props Config offered before recent Google changes

    Not currently on the repo, but available via github, via link in OP of linked thread.

    Please note: The Uninversal Safetynet Fix is now soemtimes integrated into ROM's, please check your ROM doesnt already include it before installing it.


    Pre Installation Checks (To proactively head off the common reasons the module will fail)

    Check For Identified Conflicting Magisk Modules: (tracked by @pndwal)
    • SafetyPatch
    • FDE.AI
    These modules should be removed prior to trying this module. Failure to remove = no support.


    Check For EdXposed: (Steps/tips courtesy of @kevinwu128, via @pndwal)

    Method:

    In EdXposed Installer

    1. Enable Black/White list in EdXp Settings
    2. Blacklist Google Play Services in Black/White list
    3. Reboot
    4. Check SafetyNet status in Magisk Manager

    In EdXposed Manager

    1. Enable App List Mode in Settings
    2. Blacklist Google Play Services in Application List
    3. Reboot
    4. Check SafetyNet status in Magisk Manager

    If the above fails search the thread with the keyword "edXposed" for further tips


    Check for ctsProfile (pass/fail) and/or evalType (basic/hardware) in Magisk Manager:

    Opem Magisk Manager and tap check SafetyNet to do an attestation test, which apart from the usual basicIntegrity and ctsProfile tests, now provides a test showing how the attestation is generated/processed, evalType is either BASIC or Hardware

    Please note that Google could change this at any time and force all devices to use hardware attestation, though its unlikely that they care about your Galaxy S4 that youre stubbornly hanging onto.......

    Method:

    To check open Magisk Manager and tap Check SafetyNet mid way down the opening screen

    Based on the results, choose which path below to follow:

    • Result: ctsProfile of fail and evalType of Basic

      Solution: Install a FingerPrint via MagiskHide Props Config (thanks be to @Didgeridoohan)

      These are the simplified steps, for more info on fingerprints and patch levels read the doc or visit the MagiskHide Props Config thread

      Method To Install A Fingerprint:
      1. Install MagiskHide Props Config (from magisk repo)
      2. Check that MagiskHide is enabled in Magisk Manager:
        • Click the settings icon (gear in top right)
        • Scroll to Magisk section
        • Toggle MagiskHide on
      3. Reboot
      4. Open a terminal and type su (grant permissions when prompted)
      5. Type props
      6. Type 1
      7. Type f
      8. Type the number that matches your devices manufacturer
      9. Type the number that matches your devices model
      10. Type the number that matches your android version
      11. Type y
      12. Type e to exit
    • Test SafetyNet again via Magisk Manager, if all passes continue to Clear Play Store & Play Store Services Data & Check Play Store Certification below

      See here for more info: https://github.com/Magisk-Modules-R...ices-fingerprint-to-pass-the-ctsprofile-check

    • Result: ctsProfile of fail and evalType of Hardware
      • Install Universal SafetyNet Fix (thanks be to @kdrag0n), reboot and test SafetyNet again via Magisk Manager, if all passes continue to Clear Play Store & Play Store Services Data & Check Play Store Certification below, otherwise consider installing a fingerprint via MagiskHide Props Config (thanks be to @Didgeridoohan)
      • Method To Install A Fingerprint:
        1. Install MagiskHide Props Config and reboot
        2. Open a terminal and type su (grant permissions when prompted)
        3. Type props
        4. Type 1
        5. Type f
        6. Type the number that matches your devices manufacturer
        7. Type the number that matches your devices model
        8. Type the number that matches your android version
        9. Type y
        10. Type e to exit

        See here for more info:

        Spoofing fingerprints: https://github.com/Magisk-Modules-R...ices-fingerprint-to-pass-the-ctsprofile-check

      • Test SafetyNet again via Magisk Manager, if all passes continue to GPay SQLite Fix install below

        If the above fails, please post in the MagiskHide Props Config thread for best chance of success, please be aware that the ability to even attempt to trick the system as MagiskHide Props Config currently does may be shutdown by Google at any time


    Clear Play Store & Play Store Services Data & Check Play Store Certification
    • Toggle Airplane Mode on
    • Clear data and cache of:
      • Google Play
      • Google Play Services
    • Usually this will be achieved by (exact steps and terminology may change per device or ROM):
      • Opening Settings
      • Going to Apps, choosing Show All Apps
      • Enabling Show System Apps via a menu option
      • Locating the app, tapping it and then finding Storage/Cache
      • Tapping Clear Data
    • Reboot (Best) and/or Toggle Airplane Mode off
    • Open Google Play Store, wait 5 minutes, go to Settings and check Certification at bottom

    Assuming you pass CTS and evalType tests, and Google Play Store Certification above, its time for the module installation.....


    Module Installation:

    The module has its best possible chance of succeeding if done on a clean flash of your ROM

    1. Install an SQLite binary (see Downloads below)
    2. Reboot if the SQLite you've just added is supplied by a magisk module (via magisk manager), so its active, as its required for GPay SQLite Fix install script.
    3. Install Gpay SQLite Fix magisk module via magisk manager (see Downloads below)
    4. At end of GPay SQLite Fix magisk module install, exit magisk manager
    5. Add card to Google Pay
    6. Reboot for gpay.sh service script to do its thing

    It *should* be that simple.


    Upgrade process (version v1.6 and above):

    - Uninstall previous version
    - Reboot
    - Install latest

    Upgrade process (versions below 1.6:

    Because the new version no longer uses chattr, for anyone using a verison older than v1.6, you will want to issue the following commands via a terminal to put /data/data/com.google.android.gms/databases/dg.db in its original state before installing the latest version:

    Code:
    su
    chattr -i /data/data/com.google.android.gms/databases/dg.db

    - Uninstall previous version
    - Reboot
    - Install latest


    Uninstall:

    1) Remove via Magisk Manager - all changes except packages hidden via MagiskHide and clearing the cache of Google Pay are reverted
    2) Reboot


    Known Issues:

    Loyalty Cards/Passes: You risk the possibility of loss of loyalty or other cards in the Passes section of Google Pay if you choose to flash the module and clear the cache & storage of Google Pay. Any version from v2.0+ will warn users and allow users to skip the clearing of Google Pay cache and app storage. This will also come with a warning that it *may* make the module fail to do its job.


    Downloads (hosted on my github):


    To download the working module zip, please click on the release link for any of the files below (this will take you to the latest release), and then download the first zip file on the following page, not the source.zip file nor the source.tar.gz below...

    To look over the code and contents in the module, use the repo link and either browse the code and contents online or download the zip from that page. If you download the zip from the repo link it will not work as a flashable magisk module....

    Gpay Fixes Downloads:


    repo: https://github.com/stylemessiah/GPay-SQLite-Fix
    release: https://github.com/stylemessiah/GPay-SQLite-Fix/releases/latest

    SQLite3 Binary Downloads:

    Universal (hopefully):

    SQLite3 Universal Binaries v1.1 (installs to /system/xbin if exists, otherwise /system/bin) here:
    repo: https://github.com/stylemessiah/SQLite3-Universal-Binaries
    release: https://github.com/stylemessiah/SQLite3-Universal-Binaries/releases/latest

    [/QUOTE]
    52
    [/COLOR]Thanks @BostonDan for this great method! My GPay just works now!

    [Edited to add @Karpfenhai's suggest to use TitaniumBackup's sqlite3 binary]

    Anyway for those sqlite impaired (this means 99.9999% of world population), here is my steps:

    If you have Titanium backup, please start from 3, if not, please start from 1

    1. Install Magisk module "SQLite for ARM aarch64 device" by ianmacd from Magisk Manager
    2. Reboot to enable this module
    3. Install your favorite terminal emulator (I use Termux)
    4. Enter Termux, then type "su" (Magisk might ask you for permission of root access, permit it.)
    5. Enter following command line by line: (This is Magisk module version. Titanium backup version is down below)

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

    6. Reboot
    7. Profit!

    For using with TitaniumBackup's sqlite3 binary, you could modify the sqlite3 path as
    /data/data/com.keramidas.TitaniumBackup/files/sqlite3 /data/data/com.google.android.gms/databases/dg.db "update main set c='0' where a like '%attest%';"

    Actually I put all those commands in a Tasker task so I could run it during each reboot (with "Monitor Start" Event). Tasker xml as attached.

    Also, if your system come with sqlite3 binary (Actually I use the one from Termux) you don't need even to install the Magisk sqlite3 module.

    I am not responsible for what you have done with your phone, but hey, just let me know if you guys have any issue and I am glad to help!
    16
    Will you mind if I add a way to automate the whole process to my GMS Toolbox app?
    16
    Magisk Method Gpay SQLite Fix.....

    v2.2 28/03/2020

    All changes due to MMT-EX upgrade to v1.5

    • changes to /common/functions.sh
    • /common/addon/Volume-Key-Selector/main.sh changed and renamed to /common/addon/Volume-Key-Selector/install.sh
    Upgrade to this version is not necessary, changes only affect module install...

    As always, the module can be found here, or in my sig below