Search code examples
google-paywalletgoogle-wallet

How to Send a Push Notification to a Generic Pass with Google Wallet API?


Stack Overflow community!

I've been working on integrating Google Wallet into my application to manage generic passes. I have successfully created, distributed, and even updated generic passes to users using the Google Wallet API. The update process for the pass object itself works flawlessly, and the changes are reflected immediately within the user's Google Wallet.

However, I'm encountering a challenge when it comes to sending a push notification to the users to inform them about these updates. Despite the successful update of the pass object, I can't seem to trigger a push notification that alerts the user to this change. I've scoured the Google Wallet API documentation for guidance on this specific aspect but haven't found clear instructions on how to send a notification related to a generic pass update.

Based on the Google Wallet API documentation, I attempted to use the textModulesData field to enable notifications as part of the pass update process. Here is the code snippet I used:

textModulesData: [ { header: 'Last Notification', body: 'hello world 000', enableNotification: true, id: 'last_notification', validTimeInterval: { start: { date: moment().add(24, 'hours').toISOString() }, end: { date: moment().add(48, 'hours').toISOString() } } }, ]

However, this approach did not work as expected—no push notification was sent to the users regarding the update. It seems I might be misunderstanding how to properly trigger notifications or there's a missing step in my process.

Thank you in advance for your assistance!


Solution

  • The answer is that it's not possible to trigger push notifications arbitrarily, unfortunately:

    Developer authored push notifications are not currently supported by Google Wallet. However Google Wallet provides timely notifications for the following passes. Developer authored push notifications are not currently supported by Google Wallet.

    The best you can do is get an automated notification triggerd 24 or 48 hours depending on what configs you have set.

    More details on how to trigger are here: https://developers.google.com/wallet/retail/offers/resources/faq#how-do-i-enable-push-notifications