So I need to integrate Android Pay into an application I'm working on. This option within the app will be for US users only however I am in the UK and am having great difficulty trying to test my implementation. I'm using a sandbox Stripe account atm as the payment processor.

Once I press the "Pay with Android Pay" button I get a popup "To make purchases using Android Pay, please set up your cards in the Android Pay app". Now the Android Pay app isn't available outside the US so I've sideloaded it, however once I try to add a card it crashes. After a quick Google it seems like this crash is the apps way of saying it's not supported outside the US.. (Great UX btw)

I've also tried adding one of the cards found here, https://developers.google.com/android-pay/test-flows, to my Google Account however they don't show up in the Android Pay app.

I'm at a bit of loss trying to test this, it seems very much like Google has overlooked the fact developers outside the US would like to implement this in their apps for their US customers.

Does anyone have any ideas about how I can test this?

(Btw I'm testing on a stock, unrooted Nexus 5 running Marshmallow. I've also tried to spoof my location to no avail.)

EDIT: Spoke to Android Pay support who informed me there is no mechanism to test outside of the US. They said it checks your IP address to determine location which is why GPS spoofing doesn't work but it also seems proxies don't work either so unless anyone has hacked a way around this it looks like when they say US only they mean US only - Including development :|

upvote
  flag
So using vpn is not an option? – ProblemSlover

2 Answers 11

I had similar issues to what you describe, but I managed to get it working from Canada. One of the changes I had to make was to use WalletConstants.ENVIRONMENT_TEST instead of the deprecated WalletConstants.ENVIRONMENT_STAGING (the latter was mentioned in almost all tutorials and examples). I also had misconfigured the PaymentMethodTokenizationParameters on the MaskedWalletRequest.

If you are still having issues with your implementation please post the code and I can take a look.

Follow these steps to convert Android pay into testable environment

  1. Install Android Pay apk from apkmirror website. Make sure you use correct apk variant. http://www.apkmirror.com/apk/google-inc/android-pay/

or

  1. You can use TunnelBear(Change VPN) App to download Android Pay App in India https://play.google.com/store/apps/details?id=com.tunnelbear.android

  2. Turn on Sandbox Mode by executing following commands from command prompt:

    adb shell
    cd /sdcard/Download;
    rm ­-f android_pay_env_override_*;
    touch android_pay_env_override_sandbox;
    
  3. Restart the phone

    • Launch the Android Pay app and add following test credit card details:

    • Card Number: 4622 9431 2999 9943 Expiry: 12/17 CVV: 125

    • Enter other details like address and proceed.

    • Card is added successfully.

enter image description here

  1. Use ENVIRONMENT_SANDBOX to integrate and test Android Pay in your app.

  2. Revert from Sandbox to Production by executing following commands from command prompt:

    adb shell
    cd /sdcard/Download;
    rm -­f android_pay_env_override_*;
    
  3. Restart phone

  4. Use ENVIRONMENT_PRODUCTION or ENVIRONMENT_TEST to integrate and test Android Pay in your app
upvote
  flag
Have tried this several times but keep getting "Your card couldn't be added". Is this working for other people? Is there particular version of Android Pay needed to get this working? – John O'Reilly
upvote
  flag
@JohnO'Reilly I have edited my answer and the change in this command: rm ­-f android_pay_env_override_*; Please include hyphen (-) before 'f'. Have you tried all commands successfully. – Garima Mathur
upvote
  flag
@JohnO'Reilly I think android pay is not converted on sandbox environment properly. We have to run all commands successfully. – Garima Mathur
upvote
  flag
Hi Garima, have tried those but no luck unfortunately. Is there particular version of apk needed? (I installed one from play store after connecting through vpn) – John O'Reilly
upvote
  flag
@JohnO'Reilly I have also installed android pay apk from play store. I have successfully converted android pay from production to sandbox to add dummy credit cards successfully not real.You wants to add dummy cards right ? Can you please explain me in brief how are you doing for it. – Garima Mathur
upvote
  flag
not sure what I did differently this time but now it's working! Thanks for the info! – John O'Reilly
upvote
  flag
next issue I'm seeing is that, within app, when I click on "Buy with Pay", it brings me to screen that says "There are no accepted cards available for user with this merchant". I'm using ENVIRONMENT_TEST (I also tried ENVIRONMENT_SANDBOX but didn't help....also looks like that's deprecated). btw where did you find info about "android_pay_env_override_sandbox"....can't find any other reference to it? – John O'Reilly
upvote
  flag
ok, turned out issue was that wallet fragment in layout file was referring to "test" and should have been "sandbox" (as java code is using). – John O'Reilly
upvote
  flag
@JohnO'Reilly Great !! Okay if you have any other issue then let me know – Garima Mathur
upvote
  flag
I'm still curious about use of ENVIRONMENT_TEST vs ENVIRONMENT_SANDBOX ....particularly given that the latter has been deprecated. – John O'Reilly
upvote
  flag
@JohnO'Reilly you can use both of them for testing. – Garima Mathur
upvote
  flag
@ Garima I had tried ENVIRONMENT_TEST but it hadn't worked for some reason. Does that work for you (using the "android_pay_env_override_sandbox" approach described above)? – John O'Reilly
upvote
  flag
@JohnO'Reilly you can use ENVIRONMENT_SANDBOX for testing. Let's try it once. – Garima Mathur
upvote
  flag
This has stopped working for me again....is anyone else having issues? I get the "Your card couldn't be added" message again. – John O'Reilly
upvote
  flag
Confirming you've got to use ENVIRONMENT_SANDBOX for this to work, even if it is deprecated. That means to use sandbox in /sdcard/Downloads override, GoogleApiClient initialisation and in WalletFragment options – mindeh
upvote
  flag
@GarimaMathur I am getting this error "Your card couldn't be added". I done everything properly but still getting this error. Please help. – pratik bhiyani
upvote
  flag
can any one reply? – pratik bhiyani
upvote
  flag
@pratikbhiyani Have you done wtih all steps properly? I think something would be missing in configuration. – Garima Mathur
upvote
  flag
The card mentioned in this link worked for me from India github.com/android-pay/androidpay-quickstart/issues/… – Karthik Murugan
upvote
  flag
Hi Garima, In the step2 rm -­f command is not working when i executing: shell@gtel3g:/sdcard/Download $ rm -f android_pay_env_override_*; Getting: rm failed for -f, No such file or directory What I'm doing wrong ? I have installed Android Pay_1_2_7.apk – Deven
upvote
  flag
Following same steps but not working for me... – Dharmendra
upvote
  flag
@Dharmendra I have added a default credit card at today. So, I think you are missing something in configuration. – Garima Mathur
upvote
  flag
@Deven I think you should be used TunnelBear(Change VPN) App to download Android Pay App in India. – Garima Mathur
upvote
  flag
@pratikbhiyani Have you changed the Android Pay's production environment to sandbox. – Garima Mathur
upvote
  flag
Use ENVIRONMENT_SANDBOX to integrate and test Android Pay in your app. - what does it mean? – Ihor Kostenko
upvote
  flag
@IhorKostenko To convert Android pay into testable environment: Use ENVIRONMENT_SANDBOX in source code to integrate and test Android Pay in your app successfully. – Garima Mathur
upvote
  flag
@Garima Really Thanks to answer ! I am configure android pay app for sandbox mode in india and tested it. But Today(4 Nov 2017) i open the app and click on Get Started each time it shows "Something went wrong Please try again" Dialog. – Jeetu
upvote
  flag
@Jeetu Okay, I think we have to check Android logs in this case it can tell you the internal error about "Something went wrong Please try again" Dialog. – Garima Mathur
upvote
  flag
@Garima Thanks for reply ! This Dialog come in android pay app when i click on "Getting Started" Button in my app code it return always 1 in result code. – Jeetu
upvote
  flag
Hi @GarimaMathur I have tried the above steps. But while saving the cards I am facing an issue. The App shows a dialog with error 'Double check your card details'. I have entered the details as mentioned above and provided some fake address. But it is not working. Any comments. Also, I am currently located in UK region. So, is there any other way to test the Android Pay using any other test cards please? Thanks – udai
upvote
  flag
@udai The App shows a dialog with error 'Double check your card details'. It means that somewhere we are unable to convert app in testable environment. So, it shows you the errors for production environment. I think you have to convert app in testing environment first for further processing. – Garima Mathur

Not the answer you're looking for? Browse other questions tagged or ask your own question.