Monday, August 8, 2022
HomeSoftware DevelopmentLess complicated Google Pockets integration for Android builders

Less complicated Google Pockets integration for Android builders


Hyperlink copied to clipboard

Posted by Petra Cross, Engineer, Google Pockets and Jose Ugia, Google Developer Relations Engineer

Right now greater than ever, shoppers anticipate to have the ability to digitize their bodily pockets, from funds and loyalty to tickets and IDs. At Google I/O we introduced Google Pockets, which permits customers to do precisely that. Shoppers can securely retailer and handle their cost and loyalty playing cards, board a flight, entry a gymnasium and rather more, all with simply their Android cellphone.

For Android builders, who handle their very own digital passes, Google Pockets presents a quick and safe entry level, particularly when fast entry is required. Google Pockets shall be rapidly accessible from the machine lock display screen on Pixel gadgets and from the pulldown shade. Your customers will have the ability to rapidly entry their passes after they want them – multi functional place.

Integrating with Google Pockets grew to become even simpler and extra versatile. We’ve summarized the information of what you possibly can anticipate as an Android developer.

New Android SDK

The present Android SDK helps saving three sorts of passes: presents, loyalty playing cards, and present playing cards. You requested us so as to add help for different go varieties, and we’ve heard you. Right now, we’re asserting a brand new, extra extensible API and Android SDK, that along with tickets, boarding passes, and transit tickets, and extra go varieties, consists of help for the brand new generic go, which lets your customers retailer any go or card to Google Pockets. The Android SDK enables you to create passes utilizing JSON or JSON Internet Token as a payload with out a backend integration.

Utilizing the Android SDK is simple. First, you create a payload with details about the go. You may both construct it instantly in your Android app, or retrieve it out of your backend stack. Then, you name the savePasses or savePassesJwt technique within the “PayClient” so as to add the go to Google Pockets.

Right here is the way you outline and save a pattern generic go object:





  “cardTitle”: {

    “defaultValue”: {


      “worth”“Your Program Identify”



  “header”: {

    “defaultValue”: {


      “worth”“Alex McJacobs”




non-public val addToGoogleWalletRequestCode = 1000

non-public val walletClientPayClient = Pay.getClient(utility)

non-public val jwtString = “” // Fetch a beforehand created JWT with go information

walletClient.savePassesJwt(jwtString, thisaddToGoogleWalletRequestCode)

As soon as your app calls savePassesJwt, the method guides your customers by means of the movement of including a go to Google Pockets, and permits them to preview the go earlier than confirming the save operation.

Developer documentation, samples and codelabs

Yow will discover the brand new Pockets API documentation on We personalized our developer guides for every go kind to make all the knowledge simply accessible to your particular wants. Additionally, you will discover loads of code samples demonstrating methods to examine for availability of the Google Pockets API on the Android machine, methods to deal with errors, and methods to add the “Add to Google Pockets” button to your app.

Don’t neglect to play with our interactive passes visible demo, which helps you to fill within the fields and create your personal customized go prototype with out writing a single line of code. The instrument additionally generates code samples that you should utilize to construct this go’ information buildings which we name “courses” and “objects”.

We’re actually excited to construct a terrific digital pockets expertise with you, and may’t wait to see how you employ the Google Pockets API to complement your buyer expertise. Check out our hands-on workshop “Digitize any pockets object with the Google Pockets API” to see a full integration tutorial on Android.

Study extra



Most Popular

Recent Comments