ภาพรวม
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Google Wallet Passes API ทำให้พาร์ทเนอร์สามารถประหยัดเงิน
กำลังหมุน
บาร์โค้ดไปยัง Google Wallet บาร์โค้ดเหล่านี้จะใช้ได้เพียงระยะเวลาสั้นๆ
ที่ให้ความปลอดภัยมากขึ้นเพื่อลดความเสี่ยงของภาพหน้าจอบาร์โค้ด
จะสร้างขึ้นบนอุปกรณ์ตาม
RFC 6238 โดยพาร์ทเนอร์จะระบุ
คีย์ลับ อย่างไรก็ตาม หากพาร์ทเนอร์ต้องการสร้างบาร์โค้ดเอง Google จะให้
API ที่ผู้ใช้สามารถอัปโหลดบาร์โค้ดเป็นกลุ่มไปยัง Google ได้ บาร์โค้ดเหล่านี้จะ
ส่งผ่านไปยังผู้ใช้ ซึ่งจะทำหน้าที่เหมือนการหมุนบาร์โค้ด
แสดงเป็นระยะเวลาสั้นๆ เราเรียกโซลูชันนี้ว่า "สร้างโดยพาร์ทเนอร์"
บาร์โค้ดแบบหมุนเวียน
Rotating Barcode API ที่พาร์ทเนอร์สร้าง
บาร์โค้ดแบบหมุนเวียนที่พาร์ทเนอร์สร้างขึ้นโดยใช้ RotatingBarcode เดียวกัน
ออบเจ็กต์ ต้องระบุประเภทเท่านั้น แต่เราขอแนะนําให้สร้างเงื่อนไขเริ่มต้นขนาดเล็กด้วย
ชุดบาร์โค้ด (ใช้เวลาประมาณ 10 นาที) แล้วส่ง
initialRotatingBarcodeValues
พาร์ทเนอร์มีหน้าที่รับผิดชอบในการตรวจสอบว่า
มีบาร์โค้ดที่ถูกต้องพร้อมใช้งานสำหรับผู้ใช้เสมอ และ initialRotatingBarcodeValues
ช่วยให้
การเรียกการอัปโหลดกลุ่มครั้งต่อๆ ไปจะเป็นแบบไม่พร้อมกัน
rotatingBarcode {
initialRotatingBarcodeValues: object (RotatingBarcodeValues),
type: enum (BarcodeType),
}
ช่อง |
คำอธิบาย |
initialRotatingBarcodeValues |
object (RotatingBarcodeValues)
ค่าที่จะเข้ารหัสในบาร์โค้ด ต้องระบุอย่างน้อย 1 ค่า ชื่อย่อเหล่านี้
บาร์โค้ดมีไว้เพื่อเชื่อมช่องว่างระหว่างตอนที่ผู้ใช้ได้รับบัตรครั้งแรก และ
เมื่อมีการเรียกการอัปโหลดกลุ่มครั้งต่อๆ ไป
|
type |
enum (BarcodeType)
ต้องระบุ ประเภทของบาร์โค้ดนี้
ค่าที่ยอมรับได้ มีดังนี้
|
RotatingBarcodeValues
ช่อง |
คำอธิบาย |
startDateTime |
string
วันที่/เวลาที่บาร์โค้ดแรกมีผล บาร์โค้ดจะหมุนเวียนผ่าน
ด้วย periodMillis
นี่คือวันที่/เวลาในรูปแบบ ISO 8601 แบบขยายพร้อมออฟเซ็ต
|
values[] |
string
ค่าที่จะเข้ารหัสในบาร์โค้ด ต้องระบุอย่างน้อย 1 ค่า
ไม่มีจำนวนค่าสูงสุด แต่โปรดทราบว่าขนาดของส่วนเนื้อหาของคำขอ
ต้องไม่เกิน 5 MB
|
periodMillis |
number
ระยะเวลาที่ใช้ได้สำหรับบาร์โค้ดแต่ละรายการ
|
การอัปเดตค่าบาร์โค้ดเป็นกลุ่ม
หลังจากสร้างออบเจ็กต์ RotatingBarcode แล้ว เราขอแนะนำให้อัปโหลด
บาร์โค้ดทุกวัน จนกว่าบัตรของผู้ใช้จะหมดอายุ ซึ่งทำได้ด้วย
ปลายทาง API ของ REST ต่อไปนี้
เมธอด: transitobject.uploadrotatingbarcodevalues
อัปโหลดค่าบาร์โค้ดแบบหมุนเวียนไปยังออบเจ็กต์ทรานซิชันที่อ้างอิงโดยรหัสออบเจ็กต์ที่กำหนด
คำขอ HTTP
POST
https://walletobjects.googleapis.com/upload/walletobjects/v1/transitObject/{resourc
eId}/uploadRotatingBarcodeValues
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
คำอธิบาย |
resourceId |
string
ตัวระบุที่ไม่ซ้ำกันสำหรับออบเจ็กต์
|
เนื้อหาของคำขอ
เนื้อหาของคำขอ (ซึ่งต้องไม่เกิน 5 MB) มีอินสแตนซ์
RotatingBarcodeValues
เมธอด: transitobject.downloadrotatingbarcodevalues
ดาวน์โหลดค่าบาร์โค้ดแบบหมุนสำหรับออบเจ็กต์ทรานซิชันที่อ้างอิงโดยวัตถุที่ระบุ
ID ซึ่งจะเป็นประโยชน์หากพาร์ทเนอร์ต้องการยืนยันกลุ่มล่าสุด
คำขอ HTTP
GET
https://walletobjects.googleapis.com/walletobjects/v1/transitObject/{resourceId}/do
wnloadRotatingBarcodeValues?alt=media
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
คำอธิบาย |
resourceId |
string
ตัวระบุที่ไม่ซ้ำกันสำหรับออบเจ็กต์
|
กลไกสำรอง
โปรดทราบว่าหาก RotatingBarcode ที่ถูกต้องเป็นอย่างอื่นไม่มีบาร์โค้ดที่ถูกต้องที่จะแสดง
ยังไม่มีการอัปโหลด หรือใช้บาร์โค้ดปัจจุบันทั้งหมด)
จะแสดงต่อผู้ใช้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eGoogle Wallet now supports Partner-Generated Rotating Barcodes for enhanced security, allowing partners to generate and upload time-limited barcodes directly.\u003c/p\u003e\n"],["\u003cp\u003ePartners can integrate Rotating Barcodes using the \u003ccode\u003erotatingBarcode\u003c/code\u003e object within the Google Wallet Passes API, specifying the barcode type and initial values.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides methods for batch uploading (\u003ccode\u003etransitobject.uploadrotatingbarcodevalues\u003c/code\u003e) and downloading (\u003ccode\u003etransitobject.downloadrotatingbarcodevalues\u003c/code\u003e) barcode values for ongoing updates.\u003c/p\u003e\n"],["\u003cp\u003eTo ensure continuous barcode availability, it is recommended to upload a day's worth of barcodes daily until a user's pass expires, utilizing the \u003ccode\u003einitialRotatingBarcodeValues\u003c/code\u003e for a smooth initial experience.\u003c/p\u003e\n"],["\u003cp\u003eIf a Rotating Barcode lacks valid values, an error message will be displayed to the user, highlighting the importance of timely barcode updates.\u003c/p\u003e\n"]]],["The Google Wallet Passes API enables partners to use Partner-Generated Rotating Barcodes, enhancing security by having barcodes valid for a short time. Partners can define a `RotatingBarcode` object specifying the barcode `type` and `initialRotatingBarcodeValues`. They then batch upload barcode values using the `transitobject.uploadrotatingbarcodevalues` API endpoint and should upload a day's worth of barcodes each day. Barcode values can be downloaded via `transitobject.downloadrotatingbarcodevalues` for verification. If no valid barcodes are available, an error message is shown.\n"],null,["# Overview\n\nThe Google Wallet Passes API provides the ability for partners to save\n[Rotating\nBarcodes](/wallet/tickets/transit-passes/qr-code/resources/rotating-barcodes) to the Google Wallet. These barcodes are only valid for a short period of time,\nproviding additional security to reduce the risk of barcode screenshotting. The\nbarcodes are generated on device in accordance with\n[RFC 6238](https://www.rfc-editor.org/rfc/rfc6238), with the partner providing the\nsecret key. However, if a partner would rather generate the barcodes themselves, Google provides\nan API such that barcodes can be batch uploaded to Google. These barcodes will then\nbe passed through to users' phones, where they will act just like Rotating Barcodes,\ndisplaying for a short period of time. We refer to this solution as Partner-Generated\nRotating Barcodes.\n\nPartner-Generated Rotating Barcode API\n--------------------------------------\n\nPartner-Generated Rotating Barcodes are created using the same RotatingBarcode\nobject. Only the type is required, although we also recommend creating a small, starter\nset of barcodes (\\~10 minutes worth), and sending them in\n`initialRotatingBarcodeValues`. The partner is responsible for ensuring that there is\nalways a valid barcode ready for the user, and `initialRotatingBarcodeValues` allows\nthe subsequent batch upload call to be asynchronous. \n\n```gdscript\n rotatingBarcode {\n initialRotatingBarcodeValues: object (RotatingBarcodeValues),\n type: enum (BarcodeType),\n }\n```\n\n| Field | Description |\n|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `initialRotatingBarcodeValues` | `object (`[RotatingBarcodeValues](#RotatingBarcodeValues)`)` The values to encode in the barcode. At least one value is required. These initial barcodes are meant to bridge the gap between when the user first acquires their pass, and when the subsequent batch upload call is made. |\n| `type` | `enum (`[BarcodeType](/wallet/tickets/transit-passes/qr-code/rest/v1/BarcodeType)`)` Required. The type of this barcode. Acceptable values are: - `QR_CODE` - `PDF_417` \u003cbr /\u003e |\n\nRotatingBarcodeValues\n\n| Field | Description |\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `startDateTime` | `string` The date/time the first barcode is valid from. Barcodes will be rotated through using `periodMillis`. This is an ISO 8601 extended format date/time, with an offset. |\n| `values[]` | `string` The values to encode in the barcode. At least one value is required. There is no maximum number of values, but note that the size of the request body cannot exceed 5MB. |\n| `periodMillis` | `number` The amount of time each barcode is valid for. |\n\nBatch updating barcode values\n-----------------------------\n\nAfter the RotatingBarcode object has been created, we recommend uploading a day's\nworth of barcodes, every day, until the user's pass expires. This can be done with the\nfollowing REST API endpoint.\n\n### Method: transitobject.uploadrotatingbarcodevalues\n\nUploads rotating barcode values to the transit object referenced by the given object ID.\n\n#### HTTP request\n\n`POST\nhttps://walletobjects.googleapis.com/upload/walletobjects/v1/transitObject/{resourc\neId}/uploadRotatingBarcodeValues`\n\n#### Path parameters\n\n| Parameter | Description |\n|--------------|-----------------------------------------------|\n| `resourceId` | `string` The unique identifier for an object. |\n\n#### Request body\n\nThe request body (which cannot exceed 5MB) contains an instance of\n[RotatingBarcodeValues](#RotatingBarcodeValues).\n\n### Method: transitobject.downloadrotatingbarcodevalues\n\nDownloads rotating barcode values for the transit object referenced by the given object\nID. This is useful if partners want to verify the latest batch.\n\n#### HTTP request\n\n`GET\nhttps://walletobjects.googleapis.com/walletobjects/v1/transitObject/{resourceId}/do\nwnloadRotatingBarcodeValues?alt=media`\n\n#### Path parameters\n\n| Parameter | Description |\n|--------------|-----------------------------------------------|\n| `resourceId` | `string` The unique identifier for an object. |\n\nFallback mechanisms\n-------------------\n\nNote that if an otherwise-valid RotatingBarcode has no valid barcodes to display (they haven't been uploaded yet, or all the current barcodes have been used), an error message will be shown to the user."]]