Add a Google Wallet pass to your Flutter app

Add a Google Wallet pass to your Flutter app

Despite the good amount of official documentation, I found it challenging to integrate Google Wallet and locate relevant information. I wonder can there be such a thing as too much documentation 🤔?

The documentation covers server languages that work differently from the Flutter package, and codelabs cover only the client implementation part, not the pass creation.

I couldn’t find how to create and implement Google Wallet to Flutter from start to end. So, in this quick guide, I’ll give you a few steps on how I’ve done it.

Register for an Issuer account

Go to Google Pay and Wallet Console and register for the issuer account: https://pay.google.com/business/console/

Creating passes

After registering, you can create a pass in the console. And this might be confusing because you don’t actually need to create a pass in the console. It can all be done from the Flutter app.

Designing your pass

To design your pass, I recommend using pass builder, which is an online tool to visually create your pass:

I couldn’t find pass builders for other types, but I assume most use cases will be loyalty or generic passes. In this article, I will implement a generic pass.

Add the Flutter package

Add google_wallet package. I won’t go into details on how to use this package from your Flutter app. You can read it from the package documentation, and it depends on your state management solution.

In short, the package has only two methods, to check if device has Google Wallet. And or to save the pass to the device.

Combining it all

Now when you want to save passes, you can combine the JSON from the pass builder into a new JSON object that you from your Flutter app to create your own pass. Take care that the pass builder returns two JSON objects (one for pass class, one for pass object), which are combined like this:

Diagram on how to build pass JSON

Take care to enter the correct class ID (which is ISSUER_ID.GENERIC_CLASS_ID). The generic class ID is some ID you can give, but note that whenever you change your pass design you will have to use a new ID to create a different-looking pass.

You don’t have to use , the package will take care of signing it if you use . So, send this new JSON to and that’s it.

Congrats, you have added your own pass to Google Wallet 🚀. I hope we can agree that this feature makes Google Wallet more useful than Apple Wallet.

Alexandros Tziokas

DevOps Engineer + Flutter Developer at nights

2mo

Thanks

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics