google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

Add Google Pay Passes API

Open alexbudure opened this issue 4 years ago • 5 comments

The Google Pay Passes API is missing from the discovery index. Is it possible to add it?

https://walletobjects.googleapis.com/$discovery/rest?version=v1

alexbudure avatar Jul 28 '20 22:07 alexbudure

We are also trying to develop for passes using nodejs. Is there a recommended library to use in this case or workarounds?

andrewrutter avatar Aug 14 '20 10:08 andrewrutter

Hi, would someone be able to add it to the index? Would be great!

In the meantime, I generated the class using this repository's generators. If you'd like to use it, it's a standalone file. Just copy it to your project.

https://github.com/Segfaultd/google-api-nodejs-client/blob/master/src/apis/walletobjects/v1.ts

And for sample usage:

import { google } from 'googleapis';
import { walletobjects_v1 } from '@app/Utils/Services/Google/GoogleWalletObjects'; //REPLACE: With path to the previously downloaded file from my repo
import Walletobjects = walletobjects_v1.Walletobjects;

export default class MerchantCenterService {
    private static _instance: MerchantCenterService;
    private _walletObjects: Walletobjects;

    constructor() {
        const auth = new google.auth.GoogleAuth({
            keyFile: `${__dirname}/../Credentials/google/passes_service_account.json`, //REPLACE: with path to your service account file
            scopes: ['https://www.googleapis.com/auth/wallet_object.issuer'],
        });
        this._walletObjects = new Walletobjects({
            auth,
        });
    }

    public static getInstance = () => {
        if (!MerchantCenterService._instance) {
            MerchantCenterService._instance = new MerchantCenterService();
        }
        return MerchantCenterService._instance;
    };

    public getLoyaltyCards = () => {
        this._walletObjects.loyaltyclass.list({issuerId: '<YOUR_ISSUER_ID>'}).then(res => {
            console.log(res);
        }).catch(err => console.error(err));
    };
}

MerchantCenterService.getInstance().getLoyaltyCards();

Segfaultd avatar Dec 10 '20 09:12 Segfaultd

@Segfaultd can you give an example related to how to create the pass.

stackcru-tech avatar Apr 08 '21 21:04 stackcru-tech

When will this package support Passes API?

Baterka avatar Jul 29 '21 12:07 Baterka

Any update on this?

When will this package support Passes API?

rrazi avatar Aug 13 '21 07:08 rrazi