รหัสข้อผิดพลาดและข้อยกเว้น
การตอบกลับข้อผิดพลาด API
ตารางต่อไปนี้อธิบายรหัสข้อผิดพลาดที่ Google Wallet API อาจส่งคืน สาเหตุที่เป็นไปได้ และวิธีแก้ไข
ข้อยกเว้น |
ข้อความตัวอย่าง |
คำแนะนำ |
400 - BadRequestException |
คำขอมีอาร์กิวเมนต์ที่ไม่ถูกต้อง รหัสทรัพยากรไม่ถูกต้อง: {1234567891234567899 - ABCD1234567} |
ตรวจสอบโครงสร้างข้อมูลสำหรับประเภท รูปแบบ และความยาว จากนั้นส่งอาร์กิวเมนต์ที่ถูกต้อง |
403 - สิทธิ์ปฏิเสธข้อยกเว้น |
สิทธิ์ถูกปฏิเสธ |
ตรวจสอบว่าอีเมลบัญชีบริการที่ถูกต้องเป็นผู้ใช้ที่ได้รับอนุญาตภายใน Business Pay และ Wallet Console |
404 - NotFoundException |
ไม่พบ Wallet Object {1234567891234567899.SampleClubCardxf6a8edf-87ca-4022-a813-694cc57e9fd3} |
ทำ GET บนรหัสออบเจ็กต์ก่อนลองใช้ก่อนคำขอ PATCH หรือ PUT เพื่อให้มั่นใจว่าคุณมีออบเจ็กต์ที่จะอัปเดตและเป็นเวอร์ชันล่าสุด |
404 - IssuerClassNotFoundException |
ไม่พบ Wallet Object Class {1234567891234567899.ABCD.1234567} |
เมื่อดำเนินการอัปเดต ให้ส่งคำขอ GET ก่อนคำขอ PATCH หรือ PUT เพื่อให้มั่นใจว่าคุณมีคลาสที่จะอ้างอิงว่าเป็นคลาสล่าสุด นอกจากนี้ โปรดตรวจสอบว่ามีการใช้เปย์โหลด (ออบเจ็กต์และคลาส) ที่ถูกต้องในคำขออย่างถูกต้อง |
409 - AlreadyExistsException |
มี Wallet Object Class {1234567891234567899.ABCD.1234567} อยู่แล้ว |
ดำเนินการ GET กับรหัสชั้นเรียนก่อนที่จะสร้างรหัสชั้นเรียนเดียวกัน หากมีทรัพยากรอยู่แล้ว คุณอาจต้องการใช้ PATCH หรือ PUT. |
ข้อความแสดงข้อผิดพลาดบนเว็บ
หากเกิดข้อผิดพลาดเมื่อคุณพยายามบันทึกบัตรโดยใช้ลิงก์ "เพิ่มลงใน Google Wallet" คุณจะเห็นข้อความแสดงข้อผิดพลาดที่ให้ข้อมูลเพื่อช่วยในการแก้ไขข้อบกพร่อง ข้อความเหล่านี้จะแสดงต่อผู้ใช้ที่มีบทบาท "นักพัฒนาซอฟต์แวร์" หรือ "ผู้ดูแลระบบ" สำหรับบัญชีผู้ออกบัตรที่เชื่อมโยงเท่านั้น
ตัวอย่างประเภทข้อความแสดงข้อผิดพลาดที่อาจแสดงมีดังนี้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-02-28 UTC
[null,null,["อัปเดตล่าสุด 2025-02-28 UTC"],[[["This page explains the different error codes that may be returned by the Google Wallet API, including BadRequestException, PermissionDeniedException, NotFoundException, IssuerClassNotFoundException, and AlreadyExistsException."],["Each error code has an explanation for the possible causes and suggestions for troubleshooting and resolution."],["It highlights the importance of data structure validation, proper authorization, and resource verification to avoid these errors."],["Developers and administrators with the associated Issuer account can see informative web-based error messages when saving passes using the 'Add to Google Wallet' link."],["These error messages aid in debugging issues encountered during the process of adding passes to Google Wallet."]]],["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"]]