| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This quickstart aims to help get C# developers up and running with the PassKit SDK as quickly as possible.
You will need the following:

You should have received the following 3 files when you requested your gRPC credentials:
You can disregard the key-java.pem credentials file as it is not required for C#.
The PassKit.Grpc.DotNet SDK uses the Grpc.Net.Client library which requires the credentials in PKCS12 format. To convert your files using openssl, use the following command. You will need to enter the password that you used when requesting your credentials to decrypt the private key.
openssl pkcs12 -export \ -in certificate.pem \ -inkey key.pem \ -certfile ca-chain.pem \ -out client.pfx \ -passout pass:
You should now have a client.pfx file. Create a certs folder in the root of the project and copy this file there e.g. certs/client.pfx
Edit the Quickstarts/Constants.cs file to set your region (For Europe, use pub1 and for US, use pub2). If you wish to use the Flights quickstart, you will also need to have uploaded an Apple Pass Certificate to your account and supply the PassTypeId (e.g. pass.com.passkit.quickstart). If you want to receive welcome emails for coupons, loyalty, and event tickets, provide a valid email address.
In the root poriject directory run dotnet restore to download any missing dependencies, followed by dotnet build to compile the project.
Finally dotnet run, to create a sample membership card, coupon card, event ticket and boarding pass (with default templates & tiers/offers) and issue them.
Note
You will receive some compiler warnings about unreachable code. This happens because of conditional checks on whether constants for the Apple Certificate or Email Address have been provided. They can be safely ignored.
Note
The out-of-the-box configuration will pause after each set of tests for you to examine the output. Pressing Escape at each stage will delete the assets that have been created. We recommend doing this, particularly for boarding passes where there are restrictions on multiple Carrier, Airport, Flight Designator, and Flight records.
All quickstarts are found in the Quickstarts folder.
For implementing in your own projects, use the GrpcConnectionPool or GrpcConnection class to manage connections to the PassKit gRPC endpoints. By default, this quickstart uses gRPC connection pooling to optimize performance and manage multiple requests efficiently. However, if you prefer to use the single-connection method, comment out the pooling line and use the regular connection method line in Program.cs
Note
In production when using GrpcConnectionPool you should use GrpcConnectionPool.GrpcConnectionPool.GetInstance().GetChannel() to supply one of the pooled channels with each call.
When to Use Each Mehod:
QuickstartFlights will create a carrier, flight, an arrival airport, a departure airport, flight designator and boarding pass for one person travelling with an infant. It contains the methods:
QuickstartLoyalty will create a membership program with 2 tiers, base and VIP. It will enrol two members, one in each tier. It contains the methods:
QuickstartCoupons will create a campaign with 2 offers, base and VIP. It will create two coupons, one in each offer. It will then redeem one of the coupons. It contains the methods:
QuickstartEventTickets will create a venue, production, an event, a ticket type, issue a ticket, validate a ticket and redeem a ticket.
If you prefer not to install the .NET SDK locally, or want to run the quickstart in a containerized environment, you can use the included c-sharp.sh script to build and run everything via Docker.
Ensure your gRPC credential files are present in the certs/ folder:
Edit the Quickstarts/Constants.cs file to set:
Run the Docker helper script from the root of the project: ./c-sharp.sh Run the quickstart project inside a container
To clean up the Docker image after execution, use the --clean flag: ./c-sharp.sh --clean
| Back | FazBrowse Home | New Git URL |