Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Something Went Wrong - Google Wallet API Pass Creation

I'm following the guide here: https://developers.google.com/wallet/generic/web?authuser=2 to setup my Google Wallet Pass Generic passes.

I have generated the following payload for my JWT, however every time I try to test it in Google Wallet, I see the following error:

enter image description here

This is my decoded JWT:

{
  "iss": "[email protected]",
  "aud": "google",
  "origins": [
    "www.xxx.com"
  ],
  "typ": "savetowallet",
  "payload": {
    "genericClasses": [
      {
        "id": "<issuer_id>.<random_text>",
        "classTemplateInfo": {
          "cardTemplateOverride": {
            "cardRowTemplateInfos": [
              {
                "twoItems": {
                  "startItem": {
                    "firstValue": {
                      "fields": [
                        {
                          "fieldPath": "object.textModulesData['purchased_lattes']"
                        }
                      ]
                    }
                  },
                  "endItem": {
                    "firstValue": {
                      "fields": [
                        {
                          "fieldPath": "object.textModulesData['remaining_lattes']"
                        }
                      ]
                    }
                  }
                }
              },
              {
                "twoItems": {
                  "startItem": {
                    "firstValue": {
                      "fields": [
                        {
                          "fieldPath": "object.textModulesData['available_lattes']"
                        }
                      ]
                    }
                  },
                  "endItem": {
                    "firstValue": {
                      "fields": [
                        {
                          "fieldPath": "object.textModulesData['free_lattes_received']"
                        }
                      ]
                    }
                  }
                }
              }
            ]
          }
        }
      }
    ],
    "genericObjects": [
      {
        "id": "<issuer_id>.a372e87e-4347-4e7b-b326-f2e7fb649367",
        "classId": "<issuer_id>.<same_random_text>",
        "logo": {
          "sourceUri": {
            "uri": "<png_url>"
          },
          "contentDescription": {
            "defaultValue": {
              "language": "en",
              "value": ""
            }
          }
        },
        "cardTitle": {
          "defaultValue": {
            "language": "en",
            "value": "xxxx"
          }
        },
        "subheader": {
          "defaultValue": {
            "language": "en",
            "value": "xxxxx"
          }
        },
        "header": {
          "defaultValue": {
            "language": "en",
            "value": "xxxx"
          }
        },
        "textModulesData": [
          {
            "id": "purchased_lattes",
            "header": "Purchased Lattes",
            "body": "0"
          },
          {
            "id": "remaining_lattes",
            "header": "Remaining Lattes",
            "body": "5"
          },
          {
            "id": "available_lattes",
            "header": "Available Lattes",
            "body": "0"
          },
          {
            "id": "free_lattes_received",
            "header": "Free Lattes Received!",
            "body": "0"
          }
        ],
        "barcode": {
          "type": "QR_CODE",
          "value": "<some_url>",
          "alternateText": "a372e87e-4347-4e7b-b"
        },
        "hexBackgroundColor": "#0d7787",
        "heroImage": {
          "sourceUri": {
            "uri": "<some_url>"
          },
          "contentDescription": {
            "defaultValue": {
              "language": "en",
              "value": "HERO_IMAGE_DESCRIPTION"
            }
          }
        }
      }
    ]
  },
  "iat": 1680012899
}

I have reached out to Google Wallet Support, however they haven't given me any useful feedback yet.

I also tried using the "Validate" functionality on the Google Wallet site, however it fails without any specific error.

like image 271
Alk Avatar asked Sep 16 '26 12:09

Alk


1 Answers

I've been able to have mine working. Few things I had to make sure of:

You're using the private key of the account passed within "iss", make sure your payload is small.

Here what my JWT looks like:

{
  "aud": "google",
  "iss": "[email protected]",
  "origins": [
    "localhost"
  ],
  "payload": {
    "genericClasses": [
      {
        "id": "3388XXXXXX88.NameOfClass"
      }
    ],
    "genericObjects": [
      {
        "id": "3388XXXXXX88.<object_id>",
        "classId": "3388XXXXXX88.NameOfClass"
      }
    ]
  },
  "typ": "savetowallet"
}

tbh I don't think I even need the genericClasses object in the payload.

Otherwise the info to generate your JWT are correct, I personally didn't put the iat.

I hope that helps!

Edit: I tried and can confirm you don't need the "genericClasses" in your payload.

like image 106
Jay Cee Avatar answered Sep 18 '26 00:09

Jay Cee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!