Códigos de erro e exceções
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Respostas de erro da API
A tabela a seguir explica os códigos de erro que podem ser retornados pela API Google Wallet, as possíveis causas e soluções.
Exceção |
Exemplo de mensagem |
Sugestão |
400: BadRequestException |
A solicitação contém um argumento inválido. ID de recurso inválido: {1234567891234567899 - ABCD1234567}. |
Verifique o tipo, formato e comprimento da estrutura de dados e transmita o argumento correto. |
403: PermissionDeniedException |
Permissão negada |
Verifique se o e-mail correto da Conta de serviço é um usuário autorizado no Console do Business Pay e da Carteira. |
404: NotFoundException |
Objeto da Carteira não encontrado: {1234567891234567899.SampleClubCardxf6a8edf-87ca-4022-a813-694cc57e9fd3}. |
Execute um comando GET no ID do objeto antes de tentar antes de uma solicitação PATCH ou PUT para garantir que você tenha um objeto a ser atualizado e que ele seja o mais recente. |
404: IssuerClassNotFoundException |
Classe de objeto Carteira {1234567891234567899.ABCD.1234567} não encontrada. |
Ao executar uma atualização , faça uma solicitação GET antes de uma solicitação PATCH ou PUT para garantir que você tenha uma classe para referenciar e que é a mais recente. Verifique também se o payload correto (objeto e classe) está sendo usado corretamente na solicitação. |
409: AlreadyExistsException |
A classe de objeto Carteira {1234567891234567899.ABCD.1234567} já existe. |
Use um comando GET no ID da classe antes de tentar criar esse mesmo ID. Se o recurso existir, use PATCH ou PUT. |
Mensagens de erro baseadas na Web
Se algo der errado ao tentar salvar um cartão usando a opção "Adicionar à Carteira do Google" você verá uma mensagem de erro informativa para ajudar na depuração. Essas mensagens são exibidas apenas para os usuários que têm a permissão "Desenvolvedor" ou "Administrador" para a conta de emissor associada.
Veja um exemplo do tipo de mensagem de erro que pode ser exibida:
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-09-03 UTC.
[null,null,["Última atualização 2025-09-03 UTC."],[[["\u003cp\u003eThis page explains the different error codes that may be returned by the Google Wallet API, including BadRequestException, PermissionDeniedException, NotFoundException, IssuerClassNotFoundException, and AlreadyExistsException.\u003c/p\u003e\n"],["\u003cp\u003eEach error code has an explanation for the possible causes and suggestions for troubleshooting and resolution.\u003c/p\u003e\n"],["\u003cp\u003eIt highlights the importance of data structure validation, proper authorization, and resource verification to avoid these errors.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers and administrators with the associated Issuer account can see informative web-based error messages when saving passes using the 'Add to Google Wallet' link.\u003c/p\u003e\n"],["\u003cp\u003eThese error messages aid in debugging issues encountered during the process of adding passes to Google Wallet.\u003c/p\u003e\n"]]],["The Google Wallet API returns specific error codes: 400 (BadRequestException) indicates an invalid argument, requiring checks on data structure. 403 (PermissionDeniedException) means the service account lacks authorization. 404 (NotFoundException) signals a missing Wallet Object or Class, needing a GET request before PATCH/PUT actions. 409 (AlreadyExistsException) indicates an existing class, suggesting a GET request and potential PATCH/PUT instead of creating it again. Web errors are displayed to developers and admins.\n"],null,["# Error codes and exceptions\n\nAPI error responses\n-------------------\n\nThe following table explains error codes that mayn be returned by the Google Wallet API, their possible causes, and solutions.\n\n| Exception | Example Message | Suggestion |\n|------------------------------------|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 400 - BadRequestException | Request contains an invalid argument. Invalid resource ID: {1234567891234567899 - ABCD1234567}. | Check the data structure for type, format and length and pass the correct argument. |\n| 403 - PermissionDeniedException | Permission Denied | Ensure the correct [Service Account](https://developers.google.com/wallet/retail/loyalty-cards/web/prerequisites#4.-authorize-the-service-account) email is an authorized user within your Business Pay and Wallet Console. |\n| 404 - NotFoundException | Wallet Object {1234567891234567899.SampleClubCardxf6a8edf-87ca-4022-a813-694cc57e9fd3} not found. | Perform a [GET](https://developers.google.com/wallet/generic/rest/v1/genericclass/get#http-request) on the Object ID before trying before a [PATCH](https://developers.google.com/wallet/generic/rest/v1/genericclass/patch#http-request) or [PUT](https://developers.google.com/wallet/generic/rest/v1/genericclass/update#http-request) request to ensure you have an object to update and that it's the latest. |\n| 404 - IssuerClassNotFoundException | Wallet Object Class {1234567891234567899.ABCD.1234567} not found. | When performing an update , ensure you do a [GET](https://developers.google.com/wallet/generic/rest/v1/genericclass/get#http-request) request before a [PATCH](https://developers.google.com/wallet/generic/rest/v1/genericclass/patch#http-request) or [PUT](https://developers.google.com/wallet/generic/rest/v1/genericclass/update#http-request) request to ensure you have a class to reference that it's the latest class. Also ensure the correct payload (object and class) is being used in the request correctly. |\n| 409 - AlreadyExistsException | Wallet Object Class {1234567891234567899.ABCD.1234567} already exists. | Perform a [GET](https://developers.google.com/wallet/generic/rest/v1/genericclass/get#http-request) on the Class ID before trying to create the same Class ID. If the resource exists you may want to use [PATCH](https://developers.google.com/wallet/generic/rest/v1/genericclass/patch#http-request) or [PUT.](https://developers.google.com/wallet/generic/rest/v1/genericclass/update#http-request) |\n\nWeb-based error messages\n------------------------\n\nIf something goes wrong when you attempt to save a pass using an 'Add to Google Wallet' link, you will be shown an informative error message to help you debug. These messages are only shown to users that have the 'Developer' or 'Admin' role for the associated Issuer account.\n\nHere is an example of the type of error message that might be displayed:"]]