13

By default, Android Pay refuses to work in debug builds, which makes testing tricky. What we've done so far is to actually merge new code into a develop or hotfix branch so our build environment will make a signed APK which can be tested. This is not ideal.

https://developers.google.com/android-pay/get-started states "Note: Our test environment will not return live, chargeable tokens in the FullWallet response, but will allow us to test your pre-purchase flow. You will see an Unrecognized App error on the Android Pay chooser until your app has production access." which isn't too promising.

https://developer.android.com/google/play/billing/billing_testing.html suggests testing with specially configured static responses for "reserved product IDs", which would be a nuisance to set up and not a true test. The other option they offer is to publish the app to an alpha or beta channel, which would, of course, be a signed APK. https://stripe.com/docs/mobile/android has a suggestion about "TEST_GATEWAY_TOKEN" but isn't really helpful in learning how to use Android Pay in test.

We even talked to a Google Developer Advocate, who did nothing but cut and paste some of the same documentation.

Is there any way to do a good test using an unsigned build? It would be wonderful to test Android Pay functionality successfully on a local developer machine.

Chad Schultz
  • 7,770
  • 6
  • 57
  • 96
  • May be you need create buildVariant in gradle with signing info to create signed apk on local machine? – mohax Sep 27 '16 at 00:43
  • So in other words, make a signed APK? – Chad Schultz Sep 27 '16 at 17:51
  • Yes, create signed one. As I understand yours question it solve problem with testing on local machine. But maybe I'm missing something – mohax Sep 27 '16 at 19:24
  • The question is how to test with an unsigned APK :) Our current procedure doesn't allow for the signing certificate/password to be on developer machines. Also, an unsigned build would be easier to debug, so I was wondering if there's a way. – Chad Schultz Sep 28 '16 at 14:56
  • 1
    As I understand how it works there is no way to test with debug apk. May be you can use not production release key just for test purposes? – mohax Sep 28 '16 at 15:00
  • I would guess that the Pay API need the key of the signed APK to id the transaction, so without a signed APK, no key, no ID, who receive the money ? ;) – AxelH Sep 30 '16 at 11:59

2 Answers2

1

No, there is not a debug mode option to that per docs:

https://developer.android.com/google/play/billing/billing_testing.html

set a separate machine with a CI server and have it do the alpha and beta builds for testing Google Play.

Fred Grott
  • 3,505
  • 1
  • 23
  • 18
1

It is a pity but you have only one way to test IAP:

  1. Grant testing permission to your google accout used at your device
  2. Build .apk file.
  3. Upload it to your account at GoolePlay as beta version
  4. Wait until uploaded .apk processed
  5. Try do to actions you need and check it.
  6. If any issues - fix them and start from p. 2
Vlad
  • 3,465
  • 1
  • 31
  • 24