The QuickStart includes examples for:
Membership and loyalty cards
Coupons
Event tickets
Boarding passes
This guide will help you configure your credentials, run the C# QuickStart and test the included examples.
Before You Start
Before using the C# QuickStart, you will need:
A PassKit account.
Your PassKit SDK credentials.
.NET 8 SDK or a newer supported .NET SDK/runtime.
An Apple Wallet certificate if you want to run the flights example.
You can use any C# compatible development environment or code editor.
Download the QuickStart
The C# QuickStart is available from the PassKit C# QuickStart repository.
Clone the repository and restore the project dependencies:
git clone https://github.com/PassKit/passkit-c-sharp-quickstart.git
cd passkit-c-sharp-quickstart dotnet restore c-sharp-quickstart.csproj
Alternatively, download the repository as a ZIP from GitHub, extract it and open a terminal in the extracted folder.
Get Your PassKit SDK Credentials
The PassKit SDK uses SDK credentials to securely authenticate with the PassKit API.
To generate and download your SDK credentials:
Log in to your PassKit account.
Click your account icon in the bottom-left corner, then select Account from the menu.
Select Developer Tools.
Under Account Credentials, locate SDK Credentials.
Follow the on-screen instructions to generate your credentials.
When generating your SDK credentials, you will be asked to create a password. This password encrypts your private key and is separate from your PassKit account password.
Your SDK credentials contain three files:
certificate.pemkey.pemca-chain.pem
Keep your SDK credential password and credential files secure.
Important: Do not commit or share your SDK credentials. Generating a new set of SDK credentials will invalidate your existing credentials.
Add Your SDK Credentials
In the root of the QuickStart repository, create a folder named:
certs
Add all three SDK credential files to this folder.
Your project should contain:
passkit-c-sharp-quickstart/
├── certs/
│ ├── ca-chain.pem
│ ├── certificate.pem
│ └── key.pem
The QuickStart is already configured to ignore the credential files in Git.
You do not need to manually decrypt key.pem. The SDK can use the encrypted private key with the password you created when generating your SDK credentials.
Configure the QuickStart
Create your local .env file by copying .env.example.
On macOS or Linux:
cp .env.example .env
On Windows PowerShell:
Copy-Item .env.example .env
Open .env and configure your PassKit environment and SDK credential password.
The default configuration is:
PASSKIT_ENVIRONMENT=pub1 PASSKIT_CERTIFICATE=certs/certificate.pem PASSKIT_PRIVATE_KEY=certs/key.pem PASSKIT_ROOT_CERT=certs/ca-chain.pem PASSKIT_PASSPHRASE=replace-with-your-sdk-credential-password PASSKIT_POOL_SIZE=5 PASSKIT_RECIPIENT_EMAIL= PASSKIT_APPLE_CERTIFICATE= PASSKIT_KEEP_ASSETS=false
Replace:
replace-with-your-sdk-credential-password
with the password you created when generating your SDK credentials.
Both the .env file and credential files are ignored by Git and should not be committed to source control.
Configure Your API Region
Your PASSKIT_ENVIRONMENT must match the API region associated with your PassKit account.
You can find your API region under Developer Tools → API Region in your PassKit account.
Use:
pub1for Europepub2for the United States
For example, if your account uses the European region:
PASSKIT_ENVIRONMENT=pub1
Your PassKit account and its data belong to a specific region, so make sure this value matches the region shown in your account.
Run the QuickStart
Once your credentials and .env file have been configured, run:
dotnet run --project c-sharp-quickstart.csproj
The QuickStart will display a menu:
Choose an example: 1. loyalty 2. coupons 3. tickets 4. flights Selection [1]:
Select the example you want to run.
You can also run a specific example directly from the terminal:
dotnet run --project c-sharp-quickstart.csproj -- loyalty dotnet run --project c-sharp-quickstart.csproj -- coupons dotnet run --project c-sharp-quickstart.csproj -- tickets dotnet run --project c-sharp-quickstart.csproj -- flights
Open Your Wallet Pass
When an example completes successfully, the QuickStart outputs a PassKit pass URL.
Open the URL on a compatible mobile device to add the pass to Apple Wallet or Google Wallet.
If you open the URL on a desktop, the PassKit page displays a QR code that you can scan with your phone.
What the Examples Demonstrate
Each example demonstrates a different part of the PassKit API.
Loyalty
The loyalty example demonstrates:
Creating templates
Creating a membership or loyalty program
Creating tiers
Enrolling a member
Looking up a member using an external ID
Checking a member in and out
Earning points
Burning points
Coupons
The coupons example demonstrates:
Creating templates
Creating a campaign
Creating offers
Issuing coupons
Looking up coupons
Redeeming coupons
Voiding coupons
Event Tickets
The tickets example demonstrates:
Creating a template
Creating a production
Creating a venue
Creating an event
Creating a ticket type
Issuing an event ticket
Validating a ticket
Redeeming a ticket
Flights
The flights example demonstrates:
Creating a boarding pass template
Creating a carrier
Creating airports
Creating a flight
Creating a scheduled flight designator
Adding boarding pass fields
Issuing passenger and infant boarding passes
Running the Flights Example
The flights example requires an Apple Wallet pass certificate to be uploaded to your PassKit account.
Add the Pass Type Identifier for your Apple Wallet certificate to .env:
PASSKIT_APPLE_CERTIFICATE=pass.com.example.airline
Replace the example value with your own Pass Type Identifier.
If PASSKIT_APPLE_CERTIFICATE is empty, the flights example will explain that an Apple Wallet certificate is required and exit without creating the flight resources.
Keeping Generated Resources
By default, the QuickStart automatically removes the test resources it creates after running an example.
This helps prevent test programs, campaigns, tickets and other objects from accumulating in your PassKit account.
If you want to inspect the generated resources in your PassKit account, change the following setting in .env:
PASSKIT_KEEP_ASSETS=true
When this is enabled, you will need to delete the generated resources manually.
For normal QuickStart use, leave:
PASSKIT_KEEP_ASSETS=false
Sending a Welcome Email
If you want the QuickStart to send the generated pass to an email address, set:
PASSKIT_RECIPIENT_EMAIL=
to the email address you want to use.
For example:
PASSKIT_RECIPIENT_EMAIL=example@example.com
Leave this value empty if you do not want to send a welcome email.
Troubleshooting
Credential files cannot be found
Check that certificate.pem, key.pem and ca-chain.pem are all inside the certs folder and that their filenames have not been changed.
You should also run the QuickStart commands from the repository's root folder.
Private key or certificate cannot be loaded
Check the value of:
PASSKIT_PASSPHRASE
This must be the password you created when generating your SDK credentials, not your PassKit account password.
If you no longer have the password or credential files, generate a new set of SDK credentials and replace all three files.
Authentication or connection fails
Check Developer Tools → API Region in your PassKit account and confirm that PASSKIT_ENVIRONMENT matches your account:
pub1for Europepub2for the United States
You should also check whether a VPN, firewall or network policy is blocking outbound HTTPS or gRPC connections.
Flights do not run
Confirm that an Apple Wallet certificate has been uploaded to PassKit and that its Pass Type Identifier has been added to:
PASSKIT_APPLE_CERTIFICATE
Generated resources remain in your account
The QuickStart attempts to clean up the resources created during each example.
If resources remain after an example, check the terminal output for any cleanup errors and remove the remaining resources from your PassKit account.
Also confirm that:
PASSKIT_KEEP_ASSETS=false
Next Steps
Once you have successfully run the C# QuickStart, you can use the examples as a reference when implementing PassKit in your own C#/.NET application.
For additional methods, request fields and response definitions, refer to the PassKit developer documentation.

