Skip to content

Latest commit

 

History

History
50 lines (28 loc) · 2.13 KB

README.md

File metadata and controls

50 lines (28 loc) · 2.13 KB

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