Connecting to the PassKit API with Ruby

We were recently testing PassKit as a way of managing membership cards for giving societies. Passkit is very up-front that they are not a CRM and strongly suggest using their API for integrating with outside systems, or for editing pretty much any data. To kick the tires, we set up some very basic scripts to connect to the Passkit API.

A REST example can be found on their docs. The example below shows how to get a programs’s info using Ruby.

The process consists of two steps:

  1. Generate the payload and token using the jwt gem.
  2. Connect to the API endpoint using HTTParty passing the token value with the “Authorization” header.

That’s it! From there you can modify the HTTParty path for whatever endpoint you need. Just be sure to adjust the verb and “body” in the call accordingly.