Skip to content

Node Quickstart to create, distribute, analyse and manage your Digital Membership for Apple Wallet and Google Pay

Notifications You must be signed in to change notification settings

PassKit/passkit-node-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PassKit Node Quickstart

License: MIT NPM

Overview

This quickstart aims to help get NodeJs developers up and running with the PassKit SDK as quickly as possible.

Prerequisites

You will need the following:

Configuration

  1. Download or clone this quickstart repository.

  2. Create a new folder inside src called certs and add the following three PassKit credential files into it. Files can be found in the sdk credentials email you receive on signup:

    • certificate.pem
    • ca-chain.pem
    • key.pem
  3. Add the on time password you used to generate your SDK credentials into the src/config/config.js PASSPHRASE variable and check the API region of your account here and change it accordingly. For Europe/Pub1 use ADDRESS = "grpc.pub1.passkit.io" and for USA/Pub2 use ADDRESS = "grpc.pub2.passkit.io".

  4. If you wish to receive enrolment emails, edit lines 281 and 307 of the QuickStartLoyalty class to provide an address where you can receive mail.

  5. Run npm i

Running the tests

Run npm run test

The Loyalty tests will create a membership program with 2 tiers, 2 members and 3 member events.

The tests will display URLs to the generated passes and to the enrolment page. It will pause for a period determined in the test file on line 64.

The tests will then delete and clean-up all assets that it created.

If you don't want you assets to be deleted, comment out lines 10 - 12 in the test/quick-start-loyalty.test.js file.

Notes

For implementing in your own projects, use the PassKitClient class to manage connection to the PassKit gRPC endpoints.

The quickstart uses the PassKit official node sdk found here: https://www.npmjs.com/package/passkit-node-sdk