The QuickStart includes examples for:
Membership and loyalty cards
Coupons
Event tickets
Boarding passes
This guide will help you configure your credentials, run the PHP QuickStart and test the included examples.
Before You Start
Before using the PHP QuickStart, you will need:
A PassKit account.
Your PassKit SDK credentials.
PHP 8.2 or later.
Composer.
The PHP gRPC extension.
An Apple Wallet certificate if you want to run the flights example.
You can check that PHP, Composer and the gRPC extension are available by running:
php --version composer --version php -m | grep grpc
Install and Enable the PHP gRPC Extension
The PHP QuickStart requires the gRPC PHP extension.
If grpc was not listed when running php -m, install it using PECL:
pecl install grpc
Once installed, find the active PHP configuration file:
php --ini
Make sure the active php.ini contains:
extension=grpc
Restart your terminal after enabling the extension.
For platform-specific installation instructions, refer to the official gRPC PHP documentation.
Download the QuickStart
The PHP QuickStart is available from the PassKit PHP QuickStart repository.
Clone the repository:
git clone https://github.com/PassKit/passkit-php-quickstart.git
cd passkit-php-quickstart
Then install the project dependencies:
composer install
Alternatively, download the repository as a ZIP from GitHub, extract it, open a terminal in the extracted folder and run composer install.
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 and download 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.
For PHP, you will need:
certificate.pemkey.pemca-chain.pem
The key-java.pem file is not required for PHP.
Important: Keep your SDK credentials and credential password private. Do not commit or share them through Git or another source control repository.
Add Your SDK Credentials
Create a folder named certs in the root of the QuickStart repository and add your three SDK credential files.
Your project should contain:
passkit-php-quickstart/
├── certs/
│ ├── ca-chain.pem
│ ├── certificate.pem
│ └── key.pem
The credential files are ignored by Git and should not be committed to source control.
Decrypt Your Private Key
The PHP gRPC client requires an unencrypted private key.
Rather than replacing your original encrypted key.pem, create a decrypted copy.
From the root of the QuickStart repository, run:
openssl ec -in certs/key.pem -out certs/key-decrypted.pem
When prompted, enter the password you created when generating your PassKit SDK credentials.
You should now have:
certs/
├── ca-chain.pem
├── certificate.pem
├── key.pem
└── key-decrypted.pem
Keep both the original and decrypted private keys secure.
Important: key-decrypted.pem contains your unencrypted private key. Never commit or share this file.
Configure the QuickStart
Create your local .env file by copying .env.example:
cp .env.example .env
Open .env and configure the QuickStart to use your decrypted private key:
PASSKIT_PRIVATE_KEY=./certs/key-decrypted.pem
The credential paths should be configured as:
PASSKIT_ROOT_CERT=./certs/ca-chain.pem
PASSKIT_PRIVATE_KEY=./certs/key-decrypted.pem
PASSKIT_CERTIFICATE=./certs/certificate.pem
Your .env file and credential files are ignored by Git and should not be committed to source control.
Configure Your API Region
Your QuickStart must connect to the API region associated with your PassKit account.
You can find your API region under Developer Tools → API Region in your PassKit account.
Set PASSKIT_ADDRESS in .env to the appropriate gRPC endpoint.
For Europe:
PASSKIT_ADDRESS=grpc.pub1.passkit.io
For the United States:
PASSKIT_ADDRESS=grpc.pub2.passkit.io
The default gRPC port is:
PASSKIT_PORT=443
Make sure the API region matches the region shown in your PassKit account.
Run the QuickStart
Once your dependencies, credentials and .env file have been configured, you can run one of the four complete QuickStart workflows.
Membership and Loyalty
composer example -- loyalty
Coupons
composer example -- coupons
Event Tickets
composer example -- tickets
Flights and Boarding Passes
composer example -- flights
You can also use the shorter Composer commands:
composer example:loyalty
composer example:coupons
composer example:tickets
composer example:flights
Each workflow creates the resources it needs, performs common PassKit API operations in the correct order, outputs wallet pass URLs and then cleans up the resources it created.
Open Your Wallet Pass
When a workflow successfully issues a pass, 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, you can use the displayed QR code to open the pass on your phone.
What the Examples Demonstrate
Each workflow demonstrates common operations available through the PassKit PHP SDK.
Membership and Loyalty
The loyalty workflow demonstrates common operations for creating and managing membership and loyalty programs, including:
Creating templates
Creating programs and tiers
Enrolling members
Retrieving member information
Updating members
Managing loyalty points
Checking members in and out
Managing membership resources
Coupons
The coupons workflow demonstrates common operations including:
Creating templates
Creating campaigns and offers
Issuing coupons
Retrieving coupon information
Updating coupons
Redeeming and voiding coupons
Managing coupon resources
Event Tickets
The event tickets workflow demonstrates common operations including:
Creating templates
Creating productions
Creating venues and events
Creating ticket types
Issuing event tickets
Retrieving ticket information
Validating and redeeming tickets
Managing event ticket resources
Flights
The flights workflow demonstrates common operations including:
Creating boarding pass templates
Creating carriers
Creating airports
Creating flight designators
Creating flights
Issuing boarding passes
Retrieving flight and boarding pass information
Managing flight resources
Running the Flights Example
The flights workflow requires an Apple Wallet 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 the Pass Type Identifier for your own Apple Wallet certificate.
Keeping Generated Resources
By default, the QuickStart cleans up the test resources created during each workflow.
If you want to inspect the generated resources in your PassKit account, set:
PASSKIT_KEEP_ASSETS=true
in your .env file before running the workflow.
When this is enabled, the resources will remain in your account and you will need to remove them manually.
For normal QuickStart use, leave:
PASSKIT_KEEP_ASSETS=false
Sending a Welcome Email
If you want the QuickStart to send an issued pass to an email address, set:
PASSKIT_RECIPIENT_EMAIL=
in your .env file.
For example:
PASSKIT_RECIPIENT_EMAIL=example@example.com
Leave the value empty if you do not want to send a welcome email.
Running Individual Examples
In addition to the complete workflows, the QuickStart contains individual PHP scripts for demonstrating specific PassKit API operations.
These are available in the product folders:
membership/
coupons/
event-tickets/
flights/
The individual scripts can be useful when you want to understand the request required for a specific API operation.
Run individual scripts from the repository root and check the file before running it. Some scripts require you to provide IDs or other values for existing PassKit resources.
The complete Composer workflows are recommended when getting started because they create the required dependent resources in the correct order.
Using the PHP SDK in Your Application
Once you have successfully run a QuickStart workflow, you can use its implementation as a reference when building your own PHP application.
The QuickStart provides a shared PassKitApi interface that gives you access to PassKit functionality for:
Membership and loyalty
Coupons
Event tickets
Flights
Templates, locations, beacons, links and images
Analytics and distribution
Scheduled and direct messages
Webhook integrations
Scanner configuration
Apple certificate information
Projects and passes
This provides a developer-friendly interface for common operations while still allowing access to the underlying generated SDK clients when required.
Important: Broad or potentially destructive operations are disabled by default. Only enable destructive operations when you understand the effect of the API operation and are working in a controlled environment.
Test Your Setup
The repository includes several checks that do not make calls to your PassKit account.
Run the tests with:
composer test
You can also run:
composer lint
composer check
composer security
These can be useful when modifying the QuickStart or using its code as the basis for your own integration.
Troubleshooting
PHP or Composer is not recognised
Check that PHP 8.2 or later and Composer are installed:
php --version composer --version
Make sure both commands are available from your terminal.
gRPC extension is missing
Check whether the PHP gRPC extension is enabled:
php -m | grep grpc
If it is missing, check which configuration file your command-line version of PHP is using:
php --ini
The PHP configuration used by your terminal can be different from the configuration used by a web server.
Credential files cannot be found
Confirm that your certs folder contains:
certificate.pem ca-chain.pem key.pem key-decrypted.pem
Also check that the paths configured in .env match the location of these files.
Private key cannot be decrypted
When running the OpenSSL command, use the password you created when generating your SDK credentials.
This is separate from your PassKit account password.
If you no longer have the password, generate a new set of SDK credentials.
Authentication or connection fails
Check Developer Tools → API Region in your PassKit account and confirm that PASSKIT_ADDRESS matches your region.
Use:
grpc.pub1.passkit.io
for Europe or:
grpc.pub2.passkit.io
for the United States.
Also make sure certificate.pem, key.pem and ca-chain.pem came from the same set of SDK credentials.
Flights do not run
Confirm that an Apple Wallet certificate has been uploaded to PassKit and its Pass Type Identifier has been added to:
PASSKIT_APPLE_CERTIFICATE
Generated resources remain in your account
Check the terminal output for any cleanup errors.
Also check the value of:
PASSKIT_KEEP_ASSETS
If it is set to true, generated resources are intentionally retained.
Next Steps
Once you have successfully run the PHP QuickStart, you can use the workflows and individual examples as a reference when implementing PassKit in your own PHP application.
For additional methods, request fields and response definitions, refer to the PassKit developer documentation.

