使用分組 ID
根據預設,將多張票證新增至單一「新增至 Google 錢包」連結時,並不會將使用者的 Google 錢包應用程式中的票證分組。不過,只要確認所有票證的分組 ID 都相同,即可將票證歸為一組。分組的票證會同時顯示在 Google 錢包應用程式中。如果選取一組票證,每張票證都會顯示在輪轉介面中。
票證可分為一組:
如要將票證新增至群組,必須設定票證物件的 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", }, }