Skip to content

Commit

Permalink
Added setter for WWDR Intermediate certificate with updated example a…
Browse files Browse the repository at this point in the history
…nd readme.
  • Loading branch information
ptz0n committed Sep 22, 2012
1 parent 59fb1e4 commit 1611e73
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
11 changes: 11 additions & 0 deletions PKPass.php
Expand Up @@ -116,6 +116,16 @@ public function setCertificatePassword($p) {
return true;
}

/*
* Sets the path to the WWDR Intermediate certificate
* Parameter: string, path to certificate
* Return: boolean, always true
*/
public function setWWDRcertPath($path) {
$this->WWDRcertPath = $path;
return true;
}

/*
* Decodes JSON and saves it to a variable
* Parameter: json-string
Expand All @@ -129,6 +139,7 @@ public function setJSON($JSON) {
$this->sError = 'This is not a JSON string.';
return false;
}

/*
* Adds file to the file array
* Parameter: string, path to file
Expand Down
8 changes: 4 additions & 4 deletions example.php
Expand Up @@ -3,8 +3,9 @@

$pass = new PKPass();

$pass->setCertificate('../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('test123'); // Set password for certificate
$pass->setCertificate('../Certificate.p12'); // Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('test123'); // Set password for certificate
$pass->setWWDRcertPath('../AppleWWDRCA.pem'); // Set the path to your WWDR Intermediate certificate (.pem file)

$pass->setJSON('{
"passTypeIdentifier": "pass.com.apple.test",
Expand Down Expand Up @@ -62,5 +63,4 @@
$pass->addFile('images/icon@2x.png');
$pass->addFile('images/logo.png');

$pass->create(true); // Create and output the PKPass
?>
$pass->create(true); // Create and output the PKPass
5 changes: 3 additions & 2 deletions readme.md
Expand Up @@ -24,9 +24,10 @@ Please note that iOS 6 and Passbook are still in beta, which means that the API
6. Choose a password and export the file to a folder

### Getting the example.php sample to work
1. Request the Pass certificate and upload it to your server
1. Request the Pass certificate (`.p12`) and upload it to your server
2. Set the correct path and password on [line 6 and 7](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L6)
3. Change the `passTypeIdentifier` and `teamIndentifier` to the correct values, which can be found on the [iOS Provisioning portal](https://developer.apple.com/ios/manage/passtypeids/ios/manage) after clicking on 'Configure' next to the Pass ID, on line [10](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L10) and [14](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L14)
3. Download and import your [WWDR Intermediate certificate](https://developer.apple.com/certificationauthority/AppleWWDRCA.cer) to Keychain, export as `.pem` and set the correct path on [line 8](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L8)
4. Change the `passTypeIdentifier` and `teamIndentifier` to the correct values, which can be found on the [iOS Provisioning portal](https://developer.apple.com/ios/manage/passtypeids/ios/manage) after clicking on 'Configure' next to the Pass ID, on line [11](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L10) and [15](https://github.com/tschoffelen/PHP-PKPass/blob/master/example.php#L14)

After completing these steps, you should be ready to go. Upload all the files to your server and navigate to the address of the example.php file on your iPhone.

Expand Down

0 comments on commit 1611e73

Please sign in to comment.