نمای کلی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Google Wallet Passes API این امکان را برای شرکا فراهم می کند تا بارکدهای چرخشی را در Google Wallet ذخیره کنند. این بارکدها فقط برای مدت کوتاهی معتبر هستند و امنیت بیشتری را برای کاهش خطر اسکرین شات بارکد فراهم می کنند. بارکدها بر روی دستگاه مطابق با RFC 6238 تولید می شوند و شریک کلید مخفی را ارائه می دهد. با این حال، اگر شریکی ترجیح میدهد خود بارکدها را تولید کند، Google یک API ارائه میکند که بارکدها را میتوان دستهای در Google آپلود کرد. سپس این بارکدها به تلفن های کاربران منتقل می شوند، جایی که دقیقاً مانند بارکدهای چرخشی عمل می کنند و برای مدت کوتاهی نمایش داده می شوند. ما به این راه حل به عنوان بارکدهای چرخشی شریک تولید شده اشاره می کنیم.
API بارکد چرخشی ایجاد شده توسط شریک
بارکدهای چرخشی ایجاد شده توسط شریک با استفاده از همان شیء RotatingBarcode ایجاد می شوند. فقط نوع مورد نیاز است، اگرچه ما همچنین توصیه میکنیم مجموعهای از بارکدهای شروع کوچک (حدود 10 دقیقه) ایجاد کنید و آنها را در initialRotatingBarcodeValues
ارسال کنید. شریک مسئول اطمینان از این است که همیشه یک بارکد معتبر برای کاربر آماده است، و initialRotatingBarcodeValues
اجازه می دهد تا تماس آپلود دسته ای بعدی ناهمزمان باشد.
rotatingBarcode {
initialRotatingBarcodeValues: object (RotatingBarcodeValues),
type: enum (BarcodeType),
}
میدان | توضیحات | initialRotatingBarcodeValues | object ( RotatingBarcodeValues ) مقادیری که باید در بارکد رمزگذاری شوند. حداقل یک مقدار مورد نیاز است. این بارکدهای اولیه برای پر کردن فاصله بین زمانی که کاربر برای اولین بار پاس خود را دریافت می کند و زمانی که تماس آپلود دسته ای بعدی برقرار می شود، ایجاد شده است. |
type | enum ( BarcodeType ) مورد نیاز. نوع این بارکد مقادیر قابل قبول عبارتند از: |
چرخش بارکد مقادیر میدان | توضیحات | startDateTime | string تاریخ/زمانی که اولین بارکد از آن معتبر است. بارکدها از طریق periodMillis چرخانده می شوند. این یک تاریخ/زمان با فرمت توسعهیافته ISO 8601، با یک افست است. |
values[] | string مقادیری که باید در بارکد رمزگذاری شوند. حداقل یک مقدار مورد نیاز است. حداکثر تعداد مقادیر وجود ندارد، اما توجه داشته باشید که اندازه بدنه درخواست نمی تواند بیش از 5 مگابایت باشد. |
periodMillis | number مدت زمانی که هر بارکد برای آن معتبر است. |
به روز رسانی دسته ای مقادیر بارکد
پس از ایجاد شی RotatingBarcode، توصیه می کنیم هر روز بارکدهای یک روز را بارگذاری کنید تا زمانی که مجوز کاربر منقضی شود. این را می توان با نقطه پایانی REST API زیر انجام داد.
روش: transitobject.uploadrotatingbarcodevalues
مقادیر بارکد چرخشی را به شی انتقالی که توسط شناسه شی داده شده ارجاع داده شده است، آپلود می کند.
درخواست HTTP
POST https://walletobjects.googleapis.com/upload/walletobjects/v1/transitObject/{resourc eId}/uploadRotatingBarcodeValues
پارامترهای مسیر
پارامتر | توضیحات | resourceId | string شناسه منحصر به فرد برای یک شی. |
درخواست بدن
بدنه درخواست (که نمی تواند بیش از 5 مگابایت باشد) حاوی نمونه ای از RotatingBarcodeValues است.
روش: transitobject.downloadrotatingbarcodevalues
مقادیر بارکد چرخشی را برای شی ترانزیت که توسط شناسه شی داده شده ارجاع داده شده است، دانلود می کند. این در صورتی مفید است که شرکا بخواهند آخرین دسته را تأیید کنند.
درخواست HTTP
GET https://walletobjects.googleapis.com/walletobjects/v1/transitObject/{resourceId}/do wnloadRotatingBarcodeValues?alt=media
پارامترهای مسیر
پارامتر | توضیحات | resourceId | string شناسه منحصر به فرد برای یک شی. |
مکانیسم های بازگشتی
توجه داشته باشید که اگر یک بارکد چرخشی که در غیر این صورت معتبر است، بارکد معتبری برای نمایش نداشته باشد (هنوز آپلود نشده است، یا از همه بارکدهای فعلی استفاده شده است)، یک پیام خطا به کاربر نشان داده می شود.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]