Google Wallet Integration for Event Tickets in Mobile Apps
Google Wallet lets you add concert, sports, or festival tickets directly to Android Wallet — without opening the app at entry. Users present the QR or barcode directly from the lock screen. Integration requires server-side work: Google Wallet API works with JWTs signed by a service account.
How It Works: EventTicketObject
Google Wallet uses EventTicketClass (template) and EventTicketObject (specific ticket). The class is created once per event, objects are created for each ticket.
Process:
- Create
EventTicketClassvia Google Wallet API (REST) — event description, logo, color scheme - For each ticket, create
EventTicketObjectwith barcode and seat data - Generate JWT with the object, send to the app
- App calls the "Add to Google Wallet" button
Server-Side: JWT and Google Wallet API
You need a service account in Google Cloud Console with the Wallet Object Issuer role.
import jwt
from google.oauth2 import service_account
import json
def create_event_ticket_jwt(event_id: str, ticket_id: str, holder_name: str, seat: str) -> str:
credentials = service_account.Credentials.from_service_account_file(
'service-account.json',
scopes=['https://www.googleapis.com/auth/wallet_object.issuer']
)
issuer_id = "YOUR_ISSUER_ID" # from Google Pay & Wallet Console
class_suffix = f"event_{event_id}"
object_suffix = f"ticket_{ticket_id}"
ticket_object = {
"id": f"{issuer_id}.{object_suffix}",
"classId": f"{issuer_id}.{class_suffix}",
"state": "ACTIVE",
"barcode": {
"type": "QR_CODE",
"value": ticket_id,
"alternateText": ticket_id[:8]
},
"ticketHolderName": holder_name,
"seatInfo": {
"seat": {"defaultValue": {"language": "en", "value": seat}},
"row": {"defaultValue": {"language": "en", "value": "A"}},
},
"reservationInfo": {
"confirmationCode": ticket_id[:8].upper()
},
"heroImage": {
"sourceUri": {"uri": "https://yourapp.com/event-banner.jpg"}
}
}
payload = {
"iss": credentials.service_account_email,
"aud": "google",
"typ": "savetowallet",
"iat": int(time.time()),
"origins": ["https://yourapp.com"],
"payload": {
"eventTicketObjects": [ticket_object]
}
}
token = jwt.encode(payload, credentials._private_key_pkcs8_pem, algorithm="RS256")
return token
JWT is sent to the mobile app as a string. Lifespan is 1 hour from generation.
Android: "Add to Google Wallet" Button
// build.gradle
implementation("com.google.android.gms:play-services-wallet:19.3.0")
class TicketActivity : AppCompatActivity() {
private val walletClient by lazy {
Wallet.getWalletClient(
this,
WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_PRODUCTION)
.build()
)
}
private val addToWalletLauncher = registerForActivityResult(
ActivityResultContracts.StartIntentSenderForResult()
) { result ->
when (result.resultCode) {
RESULT_OK -> showSuccess()
RESULT_CANCELED -> { /* user cancelled */ }
else -> showError()
}
}
fun addTicketToWallet(jwt: String) {
val request = SavePassesRequest.newBuilder()
.setJwt(jwt)
.build()
walletClient.savePassesViaIntent(request) { apiResult ->
apiResult.intentSender?.let { intentSender ->
addToWalletLauncher.launch(
IntentSenderRequest.Builder(intentSender).build()
)
}
}
}
}
Button According to Google Guidelines
Google strictly regulates button appearance. You cannot use arbitrary text or color. The correct way is to use the official vector or ready-made component:
<com.google.android.gms.wallet.button.PayButton
android:id="@+id/addToWalletButton"
android:layout_width="match_parent"
android:layout_height="48dp"
app:allowedAuthMethods="PAN_ONLY|CRYPTOGRAM_3DS"
app:buttonType="addToGoogleWallet" />
Checking Wallet Availability
Before showing the button, check if Google Wallet is available on the device:
walletClient.getPayApiAvailabilityStatus(
PayApiAvailabilityStatusRequest.newBuilder()
.setRequestType(PayApiAvailabilityStatusRequest.RequestType.SAVE_PASSES)
.build()
).addOnSuccessListener { status ->
if (status.isAvailable) {
addToWalletButton.isVisible = true
}
}
Wallet is unavailable on devices without Google Play Services and in some regions.
Updating Ticket After Issuance
If you need to update the QR code or ticket status (e.g., "used") — call a PATCH request to Google Wallet API with objectId. Changes apply to already-added passes in real time.
from googleapiclient.discovery import build
service = build('walletobjects', 'v1', credentials=credentials)
service.eventticketobject().patch(
resourceId=f"{issuer_id}.{object_suffix}",
body={"state": "COMPLETED"} # ticket used
).execute()
Timeline
2–3 days. Create event class, generate JWT, integrate button — 1.5 days. Update status via API + testing — 0.5–1 day. Pricing is calculated individually.







