GithubHelp home page GithubHelp logo

androidpay-quickstart's Introduction

androidpay-quickstart

Project status

status: inactive

This project is no longer actively maintained, and remains here as an archive of this work.

The Android Pay API has been superseded by the Google Pay API. Please see android-quickstart for an up-to-date sample.

Overview

This sample demonstrates basic usage of the Android Pay API. For more information, visit the following link:

https://developers.google.com/android-pay/android/tutorial

Requirements

Run the Android SDK Manager (android sdk) and ensure that you have the following installed:

  • Android SDK Build-tools 22.0.1
  • Google Play services version 25
  • Android Support Library version 22.2
  • Android Support Repository version 15

Generating a Public/Private Key Pair

In order to run this sample with the 'direct integration' model (as opposed to a processor gateway token) you will need to generate a public/private key pair and put the base64-encoded public key into the resources directory.

In order to generate a suitable key, execute the provided genkey.sh script. You should see some output like this:

Private-Key: (256 bit)
priv:
    7c:a5:b4:31:fa:ec:26:88:65:77:76:0d:c8:6f:ec:
    e1:a8:01:1d:4c:ff:04:87:4d:05:ca:a2:a1:30:49:
    2a:09
pub:
    04:d8:54:1d:f6:0d:b8:a6:fd:ca:ff:e9:ef:7d:ed:
    9a:2c:ff:fd:c1:ee:82:e0:6c:09:3d:d8:2f:ef:de:
    72:4e:0b:2a:56:2a:c9:d9:96:59:09:5a:08:ab:09:
    a8:f1:42:49:40:95:e3:3c:0c:69:67:9f:15:86:56:
    49:82:18:69:26
ASN1 OID: prime256v1

...

Taking the value of the the pub key and as $PUBLICKEY, run the following:

echo $PUBLICKEY | xxd -r -p | base64

Put the result of that commmand into app/src/main/res/values/ids.xml:

<resources>
    <string name="public_key">REPLACE_ME</string>

    ...

</resources>

The genkey.sh script uses openssl to generate the key and generates a .pem file containing the key for future reference. Consult the script for more details on how the openssl command is invoked.

androidpay-quickstart's People

Contributors

8of avatar fstanis avatar google-admin avatar justintuchek avatar samtstern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidpay-quickstart's Issues

Issue in generating hex key for android pay

Hi I am trying to use android pay . publicly and private key is generated for me using genkey.sh
Where I need to assign the PUBLICKEY value to generated public key.

While running the following command , I am getting error saying 'xxd' is not recognized as an internal or external command,
operable program or batch file.
echo $PUBLICKEY | xxd -r -p | base64

set the WalletOptions 'brand' field to ANDROID_PAY

Trying to use the Google sample app for Android Pay.
I got the error in logcat:
"To use this API, you must set the WalletOptions 'brand' field to ANDROID_PAY"

10-16 10:32:33.564 26114-355/? E/Volley: [4806] BasicNetwork.performRequest: Unexpected response code 400 for https://wallet.google.com/payments/apis/instantbuy/android/v1/getWalletItems
10-16 10:32:33.568 26114-26667/? W/BaseAppContext: Using Auth Proxy for data requests.
10-16 10:32:33.584 21959-21959/? E/OwServiceUtils: Wallet error code: 51
10-16 10:32:33.584 21959-21959/? E/OwServiceUtils: Wallet error detail: To use this API, you must set the WalletOptions 'brand' field to ANDROID_PAY.

Anyone knows why and can help out?

Not to able to find Android Pay button

screenshot_20170321-001927

I have installed androidpay-quickstart (Awesome bike store) application and I am not able to find "Buy with Android Pay" button. I have attached the screenshot for the same.
I have installed Android pay app on my device.

Kindly let me know if I am missing anything and guide me with sample card information for testing the app.

Error code 405 while trying Android Pay in TEST environment using Google Sample Code

Following are the minor changes I made for Android pay to by pass the default Google wallet implementation in the sample.

Installed latest version (8.4.89) of Google Play Services in my device

Changed dependency in the build.gradle file to use 8.3 version as "compile 'com.google.android.gms:play-services-wallet:8.3.0' "

In my device, downloaded "Android Pay" app from play store and successfully added one of supported bank card.

and

WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(BuyButtonText.BUY_WITH_GOOGLE)
.setBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_LIGHT)
.setMaskedWalletDetailsLogoImageType(WalletFragmentStyle.LogoImageType.ANDROID_PAY)
.setBuyButtonWidth(Dimension.MATCH_PARENT);

By doing this, I am able to get Android Pay logo in CheckOutActivity screen similar to first image under Payment flow section in https://developers.google.com/android-pay/payment-flows. But when I click "Buy With Android(logo) Pay" I am getting error code 405. As per under section "Invalid signing key fingerprint" in https://developers.google.com/android-pay/best-practices this typically occurs after an app in development switches from the sandbox environment to the production environment.

I have made sure I have environment set up to TEST (WalletConstants.ENVIRONMENT_TEST) in code as follows

WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();

Please NOTE I have not published this app in play store and I am trying in my local box only and do not want preauthorization to the sample app. Hence I have not followed steps as mentioned in https://developers.google.com/android-pay/preauth . Hence I am not able to verify "fingerprint provided to Google matches the fingerprint of the key used to sign the Android app" as mentioned in section "Invalid signing key fingerprint" in https://developers.google.com/android-pay/best-practices

Not sure what mistake I am doing or missing the necessary steps to run this successfully. Any help would be appreciated as I am keen to show this as POC and implement the same in our production app.

Link to stackoverflow for this same issue: http://stackoverflow.com/questions/34111438/error-code-merchant-account-error-405-while-trying-android-pay-in-test-environ

Error Code 401 at the time of walletFragment.initialize

I am getting following logcat output when I try to initialize the wallet fragment:

com.google.android.gms E/Volley: [160] BasicNetwork.performRequest: Unexpected response code 401 for https://wallet.google.com/payments/apis/instantbuy/android/v1/getWalletItems com.google.android.gms E/ServerConnection: Exception sending Volley request java.util.concurrent.ExecutionException: com.android.volley.AuthFailureError at com.android.volley.toolbox.RequestFuture.a(:com.google.android.gms:117) at com.android.volley.toolbox.RequestFuture.get(:com.google.android.gms:88) at zwt.a(:com.google.android.gms:210) at zwt.a(:com.google.android.gms:192) at aaqt.a(:com.google.android.gms:1207) at aaqs.a(:com.google.android.gms:1019) at aaqa.a(:com.google.android.gms:5099) at aajb.a(:com.google.android.gms:52) at aapz.a(:com.google.android.gms:117) at aape.a(:com.google.android.gms:6266) at aaqj.a(:com.google.android.gms:50124) at aapi.a(:com.google.android.gms:161) at aagn.onTransact(:com.google.android.gms:189) at android.os.Binder.execTransact(Binder.java:453) Caused by: com.android.volley.AuthFailureError at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:159) at iss.performRequest(:com.google.android.gms:64) at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)

When I click on Android Pay button I end up with following error:
consumerapp_error

Few more info:

  • I am developing from India where Android Pay is not available. So I am doing it in SANDBOX mode.
  • I have created OAuth 2.0 client id. (Let me know if you need something to verify it)
  • I am using Stripe as my Payment processor.

Wallet error code: 51 Wallet error detail: You have not registered to use this API

I am getting following error for Android Pay in my Production App:

Wallet error code: 51
Wallet error detail: You have not registered to use this API.

This is happening while getting MaskedWallet class's instance from MaskedWalletRequest as mentioned in below code snippet:

MaskedWalletRequest maskedWalletRequest = MaskedWalletRequest.newBuilder()
.setPaymentMethodTokenizationParameters(parameters)
.addAllowedCardNetworks(allowedCardNetworks)
.setMerchantName(AppConstants.MERCHANT_NAME)
.setCurrencyCode(currencyCode)
.setEstimatedTotalPrice(totalPrice + "")
.setCart(cart = generateCart(currencyCode))
.build();

Wallet.Payments.loadMaskedWallet(googleApiClient, maskedWalletRequest, AppConstants.MASKED_WALLET_REQUEST_CODE);

After this the Android Pay Card chooser dialog appears for a moment and immediately it gets disappear after checking the logs, I am getting this : wallet error 51.

I have used Braintree as payment processor.

Is there anything I am missing? Any help is apprecieated

Unable to contact with Google

Hi, when I click "Sign in with Google" button from Login page in the emulator, it showed "An error occurring while contacting with Google. Please try again later." Can you help me about this problem?
Thanks.

Error when switch ENVIRONMENT_TEST to ENVIRONMENT_SANDBOX

Hi. I'm OK to run the quick-start app when using ENVIRONMENT_TEST mode.
But while I change to ENVIRONMENT_SANDBOX mode, the android pay says I didn't attach a vaild card . I did nothing except for changing to ENVIRONMENT_SANDBOX mode. Is there any other configuration I need to change?

screenshot_20160530-044357
screenshot_20160530-044806

Testing Example app: Request failed Error in loadMaskedWallet

Hello,

I am trying to run the example app with the updated dependencies and gradle wrapper.
When I run it and try to make a payment after pressing the button "buy with Android pay" an error dialog shows:

Request failed: An unexpected error has occurred. Please try again later.

And after I press ok I see this message in the logs:

06-01 18:28:02.378 12251 12251 W WalletMerchantError: Error in loadMaskedWallet: Did you forget the set Android Pay testing environment to PROD?

Before trying the example app I did my own example and this is the question I opened in stackoverflow with the same results and error: https://stackoverflow.com/questions/44305488/android-pay-error-in-loadmaskedwallet

Do you have any idea what the problem could be? I have tried in two different devices and 2 different cards

Android Pay Button

Hi,

I tried running your project in android studio, I didn't see any errors but why can't I see the Buy with Android Pay button? Pleasee see attached.
capture
Hope you can help me out. Thank you!

Trying to use the sample app getting a 405.

Trying to use the sample app and am getting a ERROR_CODE_MERCHANT_ACCOUNT_ERROR. This also happens on our own debug app and recently started showing up this week. The SHA1 keys match what is on the dev api console.

Android Pay credit cards

I am developing a mobile android app and I'm interested in using Android Pay APIs. I am currently using the android pay sample app from GitHub. However, my credit cards are not from one of the participating banks with Android Pay.
I'd like to add some "fake" / sandbox credit cards to my Android Pay account. Does anyone know of any test/sandbox credit card accounts I can add/use with Android Pay? Thank you.

Android Pay App Test Account

Android Pay App Downloaded from Google Play Store doesn't allow to add Credit Cards with sandbox credentials. Then how to test my app.
Can i get any card details for testing purpose. ?

PaymentToken or Virtual Card number

Is there a way I could log the payment token or virtual card number generated ?
I can't seems to figure it out and it doesn't mention it in your documentation.

I would like to receive the tokenized card and send it to my payment provider to
process the txn.

Any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.