کدهای خطا و استثنائات
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
پاسخ های خطای API
جدول زیر کدهای خطایی را که ممکن است توسط Google Wallet API بازگردانده شود، علل احتمالی آنها و راه حل ها توضیح می دهد.
استثنا | پیام نمونه | پیشنهاد |
---|
400 - BadRequestException | درخواست حاوی یک آرگومان نامعتبر است. شناسه منبع نامعتبر: {1234567891234567899 - ABCD1234567}. | ساختار داده را از نظر نوع، قالب و طول بررسی کنید و آرگومان صحیح را ارسال کنید. |
403 - PermissionDeniedException | اجازه رد شد | مطمئن شوید که ایمیل حساب سرویس صحیح یک کاربر مجاز در کنسول Business Pay و Wallet شما باشد. |
404 - NotFoundException | Wallet Object {1234567891234567899.SampleClubCardxf6a8edf-87ca-4022-a813-694cc57e9fd3} یافت نشد. | قبل از انجام یک درخواست PATCH یا PUT ، یک GET روی شناسه Object انجام دهید تا مطمئن شوید که یک شی برای بهروزرسانی دارید و آخرین مورد است. |
404 - IssuerClassNotFoundException | کلاس شی Wallet {1234567891234567899.ABCD.1234567} یافت نشد. | هنگام انجام بهروزرسانی، مطمئن شوید که یک درخواست GET قبل از درخواست PATCH یا PUT انجام میدهید تا مطمئن شوید که کلاسی برای ارجاع به اینکه آخرین کلاس است دارید. همچنین مطمئن شوید که بار صحیح (شی و کلاس) در درخواست به درستی استفاده می شود. |
409 - AlreadyExistsException | کلاس شی Wallet {1234567891234567899.ABCD.1234567} از قبل وجود دارد. | قبل از تلاش برای ایجاد همان شناسه کلاس، یک GET روی شناسه کلاس انجام دهید. اگر منبع وجود دارد، ممکن است بخواهید از PATCH یا PUT استفاده کنید. |
پیام های خطای مبتنی بر وب
اگر هنگام تلاش برای ذخیره گذرنامه با استفاده از پیوند «افزودن به Google Wallet» مشکلی پیش بیاید، یک پیام خطای آموزنده برای کمک به رفع اشکال به شما نشان داده می شود. این پیامها فقط به کاربرانی نشان داده میشوند که نقش «توسعهدهنده» یا «مدیر» را برای حساب صادرکننده مرتبط دارند.
در اینجا نمونه ای از نوع پیام خطایی است که ممکن است نمایش داده شود:
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis page explains the various error codes returned by the Google Wallet API, including BadRequestException, PermissionDeniedException, NotFoundException, IssuerClassNotFoundException, and AlreadyExistsException.\u003c/p\u003e\n"],["\u003cp\u003eEach error code is accompanied by a description, potential causes, and suggestions for resolution, such as data validation, permission checks, and resource verification.\u003c/p\u003e\n"],["\u003cp\u003eBefore update requests (PATCH or PUT), it's crucial to perform a GET request to ensure the resource exists and you have the latest version to prevent conflicts.\u003c/p\u003e\n"],["\u003cp\u003eFor 'Add to Google Wallet' links, web-based error messages are displayed to developers and admins to aid in debugging issues during pass saving.\u003c/p\u003e\n"],["\u003cp\u003eThese messages provide insights into the problem, helping developers understand and resolve issues effectively.\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:"]]