google-wallet / android-codelab

Sample code used for the Google Wallet Android Codelab
https://codelabs.developers.google.com/add-to-wallet-android
Apache License 2.0
24 stars 16 forks source link

Getting "Something went wrong. Please try again." error in Wallet #12

Open harishpulimi opened 1 year ago

harishpulimi commented 1 year ago

I have followed the tutorial and when I click on "Add to Google Wallet" button the Wallet is showing the error "Something went wrong. Please try again." and not adding the generic pass. Also the onActivityResult in CheckoutActivity is not getting called at all.

Any ideas where its going wrong and what the error could be? Thanks

muhammed122 commented 1 year ago

Me too, getting this result always

parissakalaee commented 1 year ago

I get the same error, but I go back onActivityResult in CheckoutActivity, with this error:

PayClient.SavePassesResult.SAVE_ERROR -> data?.let { intentData ->
      val errorMessage = intentData.getStringExtra(PayClient.EXTRA_API_ERROR_MESSAGE)
 }

and the received errorMessage is this:


{
  "errorCode": "INVALID_JSON",
  "errorMessage": "Not a JSON Object"
}

I copied the JWT made by node generic_pass.js any idea to solve this issue?

parissakalaee commented 1 year ago

I solved my issue :D it was because of using walletClient.savePasses( token, this, addToGoogleWalletRequestCode ) when I need to call savePassesJwt walletClient.savePassesJwt( token, this, addToGoogleWalletRequestCode )

for anyone who read it later and has the same issue, the codelab step-by-step procedure with that node.js, needs savePassesJwt instead of savePasses!

mohamedebrahim96 commented 6 months ago

@parissakalaee

Still i'm getting "Something went wrong. Please try again" error

parissakalaee commented 6 months ago

@mohamedebrahim96 What is the exact errorMessage? PayClient.SavePassesResult.SAVE_ERROR -> data?.let { intentData -> val errorMessage = intentData.getStringExtra(PayClient.EXTRA_API_ERROR_MESSAGE) }

mohamedebrahim96 commented 6 months ago

@parissakalaee 1- i enabled the Google cloud Key for Google wallet 2- i downloaded the json file from Google cloud 3- i added (issuerId) in this file https://github.com/google-wallet/android-codelab/blob/main/backend/generic_class.js with commend node generic_class.js 4- after running the android app i'm getting this

{ "errorCode": "INVALID_JSON", "errorMessage": "Not a JSON Object" }

Screenshot 2024-05-30 at 7 16 43 PM

5- maybe should i wait for 2 days until google verify my account?