Skip to main content

A useful package to help you create Google Wallet Passes.

Project description

GoogleWalletPassGenerator

Introduction

GoogleWalletPassGenerator is a Python package designed to simplify the process of creating passes for Google Wallet. This package provides an easy-to-use interface for generating various types of passes, including event tickets, boarding passes, loyalty cards, and more, compatible with Google Wallet.

Features

  • Easy creation of Google Wallet passes.
  • Support for multiple pass types (event tickets, boarding passes, etc.).
  • Customizable pass templates.
  • Convenient serialization to JSON format compatible with Google Wallet API.

Installation

To install GoogleWalletPassGenerator, run the following command:

pip install GoogleWalletPassGenerator

Usage

Here is a basic example of how to create an EventTicket class

from GoogleWalletPassGenerator.eventticket import EventTicketManager
from GoogleWalletPassGenerator.types import TranslatedString, LocalizedString, EventTicketClass, EventTicketClassId, EventTicketObject, EventTicketObjectId, Barcode, ObjectsToAddToWallet, EventTicketIdentifier
from GoogleWalletPassGenerator.enums import ReviewStatus, State, BarcodeType, BarcodeRenderEncoding
from GoogleWalletPassGenerator.serializer import serialize_to_json

service_account_json = 'path_to_service_account_json'
manager = EventTicketManager(service_account_json)

issuerId = 'ISSUER_ID'
uniqueClassId = 'UNIQUE_CLASS_ID'
uniqueObjectId = 'UNIQUE_OBJECT_ID'

eventTicketClass = serialize_to_json(
    EventTicketClass(
        id=EventTicketClassId(
            issuerId=issuerId,
            uniqueId=uniqueClassId
        ),
        issuerName="Crafture",
        eventName=LocalizedString(
            defaultValue=TranslatedString(
                "en-US", "EVENT_NAME"
            ),
        ),
        reviewStatus=ReviewStatus.UNDER_REVIEW,  # Or any other status from the enum
    )
)

manager.create_class(eventTicketClass)

Here is a basic example of how to create an EventTicket Object of a class

eventTicketObject = serialize_to_json(
    EventTicketObject(
        id=EventTicketObjectId(
            issuerId=issuerId,
            uniqueId=uniqueObjectId
        ),
        classId=EventTicketClassId(
            issuerId=issuerId,
            uniqueId=uniqueClassId
        ),
        state=State.ACTIVE,  # Or any other state from the enum
        barcode=Barcode(
            type=BarcodeType.QR_CODE,  # Or any other barcode from the enum
            renderEncoding=BarcodeRenderEncoding.UTF_8,  # Or any other render encoding from the enum
            value="https://www.crafture.com/",
        )
    )
)

manager.create_object(eventTicketObject)

You can now create the add to Google Wallet urls:

objectsToAdd = serialize_to_json(
    ObjectsToAddToWallet(
        [
            EventTicketIdentifier(
                id=EventTicketObjectId(
                    issuerId=issuerId,
                    uniqueId=uniqueObjectId
                ),
                classId=EventTicketClassId(
                    issuerId=issuerId,
                    uniqueId=uniqueClassId
                ),
            )
        ]
    )
)

walletUrls = manager.create_add_event_ticket_urls(objectsToAdd)
print(walletUrls)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GoogleWalletPassGenerator-1.1.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GoogleWalletPassGenerator-1.1.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file GoogleWalletPassGenerator-1.1.6.tar.gz.

File metadata

File hashes

Hashes for GoogleWalletPassGenerator-1.1.6.tar.gz
Algorithm Hash digest
SHA256 da08d90b28cf0cc6fed257f774d73b1f680da63e423a7ee9044438ec1d85106d
MD5 b94dc0db2e94b6c461ca4d114477d60b
BLAKE2b-256 61d19ebda40dac6acd70add0213c848e1e50bbeb372bcd172205233538f049d1

See more details on using hashes here.

File details

Details for the file GoogleWalletPassGenerator-1.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for GoogleWalletPassGenerator-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e9960a7bf5ac82562679d14bf5b412e370131e2a9be9b84bfcffef078642ca
MD5 00d68764ad5249ae9bfb9bf50ebadf23
BLAKE2b-256 3b63c14faeae21dcd1911da52205dc11ce6a4a243925ab67a6fd370b0ee680f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page