androidandroid-studioandroid-pay

How to add fake Credit Card Visa for Android pay?


I am developing an android application which uses android pay for the payment. In the https://codelabs.developers.google.com/codelabs/android-pay/#13 website. This is what the webiste write in the documentation "Tap the Buy button and select the fake Visa credit card from before." but there are no fake account that appear. I also follow other tutorials that they have this fake account. Card Number: 4622 9431 2999 9901 Expiry: 12/17 CVV: 213

but after adding the address etc. android pay says it cannot add the credit card. How can I resolve this for developing purposes?


Solution

  • To add some "fake"/sandbox card enable Sandbox Mode by executing following commands from command prompt/terminal:

    adb shell
    cd /sdcard/Download;
    rm ­-f android_pay_env_override_*;
    touch android_pay_env_override_sandbox;
    

    Once done restart your phone and add following test credit card detail:

    Card Number: 4622 9431 2999 9901
    Expiry: 12/17
    CVV: 213
    

    After that for billing address you can use any valid billing address and your fake card will be ready to use.

    I found one more detail on android pay github issue where one of the contributor mentioned that You will need to add a real card to Android Pay, and then if you test your app using the sandbox you will not actually be charged. Link to this comment: https://github.com/android-pay/androidpay-quickstart/issues/6#issuecomment-164813626

    I am not sure if real card wont be charged when sandbox is enabled.

    To revert from Sandbox to production execute following commands from command prompt/terminal:

    adb shell
    cd /sdcard/Download;
    rm -­f android_pay_env_override_*;