admin管理员组

文章数量:1357391

I'm using library chiiya/passes to generate membership cards for my project. The github page has an example to create a generic object but, maybe I'm wrong, some information is missing.

$object = new GenericObject(
    cardTitle: LocalizedString::make('en', '::cardTitle::'),
    header: LocalizedString::make('en', '::header::'),
    subheader: LocalizedString::make('en', '::subheader::'),
    logo: Image::make('.png'),
    hexBackgroundColor: '#333',
    notifications: new Notifications(
        upcomingNotification: new UpcomingNotification(
            enableNotification: true
        ),
    ),
    classId: '1234567890123456789.generic-object',
    id: '1234567890123456789.'.Str::uuid()->toString(),
    heroImage: Image::make('.png'),
    state: State::ACTIVE,
    barcode: new Barcode(
        type: BarcodeType::QR_CODE,
        value: '1464194291627',
        renderEncoding: BarcodeRenderEncoding::UTF_8,
    ),
    validTimeInterval: new TimeInterval(
        start: new DateTime(date: now()),
        end: new DateTime(date: now()->addMonth())
    ),
    textModulesData: [
        new TextModuleData(
            header: 'label-1',
            body: 'value-1',
            id: 'key-1',
        ),
        new TextModuleData(
            header: 'label-2',
            body: 'value-2',
            id: 'key-2',
        )
    ],
    groupingInfo: new GroupingInfo(
        groupingId: 'group1'
    )
);

$jwt = (new JWT(
    iss: $credentials->client_email,
    key: $credentials->private_key,
    origins: [''],
))->addGenericObject($object)->sign();

Once the object has been created and signed using the credentials, how is it sent to Google so the pass is created and how do I offer the user the "Add to Google Wallet" button. I've seen somewhere that I need an id of the object but I haven't been able to find how to do that.

I've already created the generic class in the Google Wallet website.

Is there someone who has used this library, or similars, able to give me a hint?

Thanks

本文标签: phpGoogle Wallet How to create generic pass objectStack Overflow