จัดกลุ่มบัตรหลายใบ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ใช้รหัสการจัดกลุ่ม
โดยค่าเริ่มต้น การเพิ่มบัตรหลายใบลงในบัตรเดียว
ลิงก์เพิ่มลงใน Google Wallet จะไม่จัดกลุ่มบัตรเหล่านั้นใน
แอป Google Wallet ของผู้ใช้ อย่างไรก็ตาม สามารถจัดกลุ่มบัตรเข้าด้วยกันได้โดยทำ
ให้แน่ใจว่าทั้งหมดมีรหัสการจัดกลุ่มเดียวกัน บัตรที่จัดกลุ่มไว้จะปรากฏด้วยกัน
ในแอป Google Wallet เมื่อเลือกกลุ่มบัตรแล้ว บัตรแต่ละรายการจะ
แสดงในภาพสไลด์
บัตรสามารถจัดกลุ่มไว้ด้วยกันได้ดังนี้
- ระหว่างการจัดสรรเริ่มต้น
-
โดยการใช้
update
หรือ
patch
วิธีการ
หากต้องการเพิ่มบัตรลงในกลุ่ม ให้ใช้พร็อพเพอร์ตี้ groupingInfo.groupingId
ของ
ต้องตั้งค่าอ็อบเจ็กต์บัตร ออบเจ็กต์ทั้งหมดส่งผ่านออบเจ็กต์ที่มี
ระบบจะจัดกลุ่มค่า groupingId
เข้าด้วยกันโดยอัตโนมัติ แม้ว่า
แต่จะถูกเพิ่มแยกต่างหาก
ตัวอย่างต่อไปนี้แสดงบัตรสะสมคะแนนและข้อเสนอที่มีการจัดกลุ่มไว้ด้วยกันเพื่อ
ชักชวนผู้ใช้ให้ใช้ประโยชน์จากทั้งสองอย่างนี้ในการซื้อครั้งต่อไป
loyaltyObject = {
"classId": "ISSUER_ID.GIFT_CARD_CLASS_SUFFIX",
"id": "ISSUER_ID.GIFT_CARD_OBJECT_SUFFIX",
"state": "ACTIVE",
"groupingInfo": {
# Note the same groupingId value
"groupingId": "combinedGiftCardAndOfferId",
"sortIndex": 1
},
"barcode": {
"type": "QR_CODE",
"value": "QR code"
},
"accountId": "Account id",
"accountName": "Account name",
"loyaltyPoints": {
"label": "Points",
"balance": {
"int": 800
}
}
}
offerObject = {
"classId": "ISSUER_ID.OFFER_CLASS_SUFFIX",
"id": "ISSUER_ID.OFFER_OBJECT_SUFFIX",
"state": "ACTIVE",
"groupingInfo": {
# Note the same groupingId value
"groupingId": "combinedGiftCardAndOfferId",
"sortIndex": 2
},
"barcode": {
"type": "QR_CODE",
"value": "QR code",
},
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-04 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-09-04 UTC"],[[["\u003cp\u003eBy default, multiple passes added to Google Wallet are not grouped; however, you can group them using a \u003ccode\u003egroupingId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eGrouped passes appear together in the Google Wallet app and can be provisioned together or grouped later using the \u003ccode\u003eupdate\u003c/code\u003e or \u003ccode\u003epatch\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eTo group passes, ensure the \u003ccode\u003egroupingInfo.groupingId\u003c/code\u003e property is the same for all passes you want to group.\u003c/p\u003e\n"],["\u003cp\u003eSetting the same \u003ccode\u003egroupingId\u003c/code\u003e for different pass types like loyalty cards and offers allows you to create combined experiences for users.\u003c/p\u003e\n"]]],["Passes in Google Wallet can be grouped by assigning them a shared `groupingId`. This can be done during the initial provisioning or later using `update` or `patch` methods. Setting the `groupingInfo.groupingId` property in each pass object ensures they are grouped. Passes with the same `groupingId` appear together in the user's wallet and are shown on a carousel when selected. The example shows a loyalty card and an offer using \"combinedGiftCardAndOfferId\" to be grouped.\n"],null,["# Group multiple passes\n\nUse a grouping ID\n-----------------\n\n\nBy default, adding multiple passes to a single\n**Add to Google Wallet** link will not group those passes in the\nuser's Google Wallet app. However, passes can be grouped together by making\nsure they all have the same grouping ID. Grouped passes will appear together\nin the Google Wallet app. When a group of passes is selected, each pass will\nbe shown on a carousel.\n\nPasses can be grouped together:\n\n- During initial provisioning\n- By using the [`update`](/wallet/tickets/transit-passes/qr-code/rest/v1/transitobject/update) or [`patch`](/wallet/tickets/transit-passes/qr-code/rest/v1/transitobject/patch) methods\n\n\nTo add a pass to a group, the `groupingInfo.groupingId` property of\nthe pass object must be set. All pass objects with the same\n`groupingId` value will be automatically grouped together, even if\nthey were added separately.\n\n\nThe following example shows a loyalty card and offer being grouped together to\nentice the user to make use of both in their next purchase. \n\n```carbon\nloyaltyObject = {\n \"classId\": \"ISSUER_ID.GIFT_CARD_CLASS_SUFFIX\",\n \"id\": \"ISSUER_ID.GIFT_CARD_OBJECT_SUFFIX\",\n \"state\": \"ACTIVE\",\n \"groupingInfo\": {\n # Note the same groupingId value\n \"groupingId\": \"combinedGiftCardAndOfferId\",\n \"sortIndex\": 1\n },\n \"barcode\": {\n \"type\": \"QR_CODE\",\n \"value\": \"QR code\"\n },\n \"accountId\": \"Account id\",\n \"accountName\": \"Account name\",\n \"loyaltyPoints\": {\n \"label\": \"Points\",\n \"balance\": {\n \"int\": 800\n }\n }\n}\n\nofferObject = {\n \"classId\": \"ISSUER_ID.OFFER_CLASS_SUFFIX\",\n \"id\": \"ISSUER_ID.OFFER_OBJECT_SUFFIX\",\n \"state\": \"ACTIVE\",\n \"groupingInfo\": {\n # Note the same groupingId value\n \"groupingId\": \"combinedGiftCardAndOfferId\",\n \"sortIndex\": 2\n },\n \"barcode\": {\n \"type\": \"QR_CODE\",\n \"value\": \"QR code\",\n },\n}\n```"]]