includable / php-pkpass Goto Github PK
View Code? Open in Web Editor NEW💳 PHP class for creating passes for Wallet on iOS.
Home Page: https://includable.com
License: MIT License
💳 PHP class for creating passes for Wallet on iOS.
Home Page: https://includable.com
License: MIT License
I followed the steps to add WWDR Cert Path in my index.php and PKPass.php files. After adding, the pass is not showing in Pass format in my iPhone to add it as a pass in passbook. If i'm commenting this line in index.php, the Pass format is coming but not adding into Passbook. Please help.
Hey,
Thank you for this library !
I would like to know if it is possible to add personalization files like personalization.json
for Reward Enrollment?
I tried addFile
without any success !
Thanks
Gabriel
Hi, I've follow all the instruction and already generated the .p12 file, but I still get this following error at my macbook console after I tried to open the .pkpass file on my iPhone. My pass ID and Team ID is right, and I've already generate the .p12 file.
Error Log:
Invalid data error reading card pass.com.test.example/serial_number. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
I can view my pass on my Mac fine, but when I send it to my iPhone it never shows up. On iOS if I try to go to the pass website it says "Unable to download". The same thing happens if I try on the example websites listed on here.
If you attempt to create a pass without adding any files, Safari gives an alert saying "Download Failed. Safari cannot download this file." It looks like this is an issue with Safari/Passbook itself, rather than PHP-PKPass, but I wanted to document it in writing.
You must at the very least call $pass->addFile('images/icon.png')
. Any other files are optional.
I fought with re-generating the certificates and reconfiguring the passTypeIdentifier, teamIdentifier, etc. before realizing that this was the problem.
How to add "es.lproj" in PKPass() to support localization?
I tried to create a pass by develop on Zend Framework and add PHP-PKPass as a library.
I got a problem "Downloading Failed" on iPhone while on desktop are working fine.
And when I tried the same code on normal php is working. Anything suggestion?
Pass Service returned "log":
{"logs":["[2018-01-10 11:59:51 +0100] Web service error for xxxxx (xxxxx: Server returned the pass data for serial number 'xxxx' but did not provide a 'last-modified' header."]}
I fixed this by adding:
header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");
after line 318 (where all te header() stuff is)
Whenever I run examples/example.php all that is exported is an empty .pkpass file. I have spent many hours reading through very carefully and started over several times but cannot get this library to work. Can anyone please shed light on why this is happening?
I have set paths, permissions, ownership etc on all of the required files as well as ensured that all variables (eg team ID, pass ID etc) are set.
Hello, I am trying to install it and i get this message:
[InvalidArgumentException]
Could not find package pkpass/pkpass at any version for your minimum-stabil
ity (stable). Check the package spelling or your minimum-stability
I on laravel 5.2.41
hey this is my error code!
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 385
Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 386
Warning: file_put_contents() [function.file-put-contents]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845/manifest.json) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 308
Warning: file_put_contents(/tmp/PKPass50a50b1ef06d39.40820845/manifest.json) [function.file-put-contents]: failed to open stream: Operation not permitted in /users/phips99/www/MySQLadmin/PKPass.php on line 308
Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /users/phips99/www/MySQLadmin/PKPass.php on line 310
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845/pass.pkpass) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 405
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845/signature) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 405
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845/manifest.json) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 405
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/tmp/PKPass50a50b1ef06d39.40820845) is not within the allowed path(s): (/users/phips99/temp:/users/phips99/www) in /users/phips99/www/MySQLadmin/PKPass.php on line 411
Error: Could not read the certificate
For test purposes, I created a pass, and downloaded it from internet. The iphone then displays a UI to add the pass to PassBook.
But then, once I hit "add", nothing happens : the pass is not added. Do you also have this issue ?
PKPass/PKPass.php
Fatal error: Class 'PKPass' not found in **************/full_sample/index.php on line 15
Help Please.
I am trying to create Coupon type pass. It works fine with one Secondary field.
But if I add more than one secondary or even on Auxilliary then pas hasn't been
created.
Any idea why?
I checked the json format. No error or ,/; missing.
Thanks
I am newbie zend developer, how can we create library in ZF2?
Hi,
I am pretty new to GitHub, but I really like your project. I have tried it and it actually works. I would just like to suggest allowing the passing of variables via a URL string. This would allow easy implementation with web forms (they could have a "submit and download pass" button)
A.
Hey, is there any way to return multiple event tickets at once?
Thank's in advance!
Hi ,
I integrated this code . it was done successfully. But I am struck register device to send push notification to device (push notification web service). I am a php developer , I am trying integrate apns and gcm. But I was fail . Please provide any example code of pass push notification. Please Help me.
Hi,
I can't really generate .p12 file and password to it. I can just add a key and download .p8 file. Am I doing something wrong? I read that Apple has moved from .p12 to .p8 files.
Hi guys,
I'm new to pkpass and I'm fiddling around to make example.php work. I've followed the steps as described on the readme file by getting a certificate converting it to .p12 using Keychain Access. I have the correct password for the certificate. Downloaded the AppleWWDRCA.cer and converted it to .pem with the Keychain Access. I've entered the correct passTypeIdentifier and teamIdentifier on lines 15 and 17. All the required files have been uploaded on my server where I'm doing the test.
This is what I have entered on the example.php on the parameters required:
$pass->setCertificate('../certificate/Key2Vegas Passbook.p12'); // 2. Set the path to your Pass Certificate (.p12 file)
$pass->setCertificatePassword('********'); // 2. I have the correct password, used the asterisks for security reasons
$pass->setWWDRcertPath('../AppleWWDRCA.pem'); // 3. Set the path to your WWDR Intermediate certificate (.pem file)
// Top-Level Keys http://developer.apple.com/library/ios/#documentation/userexperience/Reference/PassKit_Bundle/Chapters/TopLevel.html
$standardKeys = array(
'description' => 'Demo pass',
'formatVersion' => 2,
'organizationName' => 'Key2Vegas',
'passTypeIdentifier' => 'pass.key2vegas.bcpass', // 4. Set to yours
'serialNumber' => '123456',
'teamIdentifier' => 'UU4Z3K5423' // 4. Set to yours
);
I know the pkpass class uses the openssl_pkcs12_read function and I know that there is where my problem is. The php version on my server is > 5.
I want to know why the class can not read the certificate? Why is it giving me a Error: Could not read the certificate message?
Thanks in advance.
On the local server everything works fine, but on the server has stopped working. openssl_pkcs7_sign () returns false, without other errors and a manifesto on the spot.
Parse error: syntax error, unexpected T_STRING in ***********************************/src/PKPass/PKPass.php on line 11
I am following all the instructions and this comes up!!!
Due to I tried to use setJSON() by giving parameter from json_encode() and i got error on iPhone that "Safari can't download the file". So I would like to suggest some fixing for this to easily format the JSON, if it's possible.
For example
"pass.com.example.passbook", "teamIdentifier" => "ABCDEFGHIJK", "formatVersion" => 1, "organizationName" => "Example", "serialNumber" => uniqid(), "backgroundColor" => "rgb(107,156,196)", "logoText" => "Company", "description" => "Demo Employee pass", "primaryFields" => array( array( 'key' => 'name', 'label' => 'Name', 'name' => $name, ), array( 'key' => 'lastName', 'label' => 'Last Name', 'lastName' => $lastName, ), array( 'key' => 'depart', 'label' => 'Depart', 'depart' => $depart, ), "barcode" => array( "format" => "PKBarcodeFormatQR", "message" => "Name: " . $name . " Last Name: " . $lastName . " Depart: " . $depart, "messageEncoding" => "iso-8859-1" ), ), ); $json = json_encode($json_data); $pass->setJSON($json); ?>On Windows and its browsers, the .pkpass file is shown as expected. Though on an iphone the file is automatically changed into a .html file and the code is simply shown on a page.
No matter what I do, I always get this error:
Warning: openssl_pkcs7_sign(): error opening the file, file://C:/Inetpub/vhosts/(domain)/httpdocs/(folder)/certs/wwdr.pem
(domain)&(folder) replaced for obv. reasons.
I've tried relative paths, i then used absolute, then tried the file:// method... I've changed MIME type for .pem to various suggestions but I'm lost. I Just don't understand why it won't work
Make PKPass follow at least PSR-0 (PSR-1 would be great, too) and working with composer.
I can generate pass successfully using this library. After generating .pkpass file i downloaded it to the mac and opened in simulator/wallet preview without any issue.
But the problem is when i am attaching .pkpass file to email or referring an link from server then .pkpass file is not opening in wallet application.
Can you pleas suggest how to open .pkpass directly into wallet app from email link or from landing page.
Thanks in advance.
how to interact with pass? like if I want device id then how can I get device id for pass modification notification ??
Hi,
safari on iphone with IOS 10.2.1 return me download error.
All certificate and psw are correct.. why?
thanks best regards
So I generated the file but it couldn't be opened. Console App just showed so errors like:
30.11.17 10:58:14,033 com.apple.PassXPCService[7692]: PAPassController: Failed to unarchive file file:///var/folders/f2/27mglkvn37g72_v3ggmgzv_800010b/T/com.apple.PassXPCService/084D0B88-160F-4A62-A6B9-B4329624A752/pass.pkpass to file:///var/folders/f2/27mglkvn37g72_v3ggmgzv_800010b/T/com.apple.PassXPCService/F5A129B7-FA68-404C-A4CB-112A1AF9083A/ - Error 2
30.11.17 10:58:14,034 Pass Viewer[7677]: ERROR: Error Domain=NSCocoaErrorDomain Code=-1 "-[NSUnarchiver unarchiveObjectWithData:] failed" UserInfo={NSLocalizedFailureReason=-[NSUnarchiver unarchiveObjectWithData:] failed}
So I just inspected the pkpass file itself:
And had this error:
Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in
/Users/xx/xxxxx/vendor/pkpass/pkpass/src/PKPass.php on line 301.
PHP Version: 7.0.15 @ macOS 10.11
HI!
The pkpass file doesn't work at iphone devices. When the file is downloaded by Safary, it is showed this error: "Safari cannot download this file". I am testing with simulator of xcode and show the next logs:
Jun 23 17:45:52 iMac assertiond[586]: assertion failed: 15C50 13E230: assertiond + 15801 [3C808658-78EC-3950-A264-79A64E0E463B]: 0x1
Jun 23 17:46:01 --- last message repeated 13 times ---
Jun 23 17:46:01 iMac MobileSafari[646]: SecTrustEvaluate [leaf SubjectOrganizationalUnit]
Jun 23 17:46:01 iMac MobileSafari[646]: Invalid data error reading pass pass.com.enubes.repsolmas/325225. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.
Jun 23 17:46:01 --- last message repeated 1 time ---
Jun 23 17:46:01 iMac MobileSafari[646]: PassBook Pass download failed: The pass cannot be read because it isn’t valid.
I have generated the p12 file like you say at https://github.com/tschoffelen/PHP-PKPass#requesting-the-pass-certificate.
Finally, I can install the pkpass at Android devices.
I hope that you can help me.
Thank you!
I notice that http://apps.tomttb.com/pkpass/full_sample does not work on iOS 7. The downloaded pass will load into the iOS simulator, but in Safari I'm getting
"Download Failed - Safari cannot download this file.", and in mobile Chrome I'm getting "Sorry, this pass cannot be added to Passbook at this time".
Whenever I generate a pass and I tap add, it disappears instead of showing the adding animation. I checked my book and it doesn't show. I even tried your example online and that doesn't work either.
All the installation instructions so far seem to be based on the assumption this is going to be running from a Mac. Has anyone here had any luck setting up the signing aspect of this project on a Windows box?
I've tried various things- installing the WWRC in MMC, converting the WWRC to a PEM, installing the Pass certificate on IIS, exporting the pass certificate as a PFX... and whilst the pass is generated it's unable to be added to Passbook (which makes me think I'm still not signing the pass correctly).
Anyone had any success using this on Windows?
Is it possible to save the generated .pkpass file directly on the server instead of downloading it?
Hi
When I execute the code I am facing the issue while downloading it says Failed to load resource: Frame load interrupted.
not able to figure out the error here and if i execute the online link of your example "http://pkpass.dev.scholica.com/examples/full_sample/" it works correctly.
please assist me in this.
I can't get creation script to generate pass locations using lat/lng variables, but it works fine when they're hardcoded.
I have written on my problem with lots of information at stackOverflow: http://stackoverflow.com/questions/29087938/passbook-hardcoding-locations-in-json-works-but-not-passing-variable
testing with PassWallet and iO6 simulator, fails in simulator.
thanks!
In i os7 its not opening please help what to do if i want to use this in i os7
Hi,
I am trying to use this PKPASS.php class for generating .pkpass files.
But after generating pass.pkpass file when we are opening this file in apple passbook app OR in mac system it is not getting open.
other .pkpass files are working fine.
In i os7 its not opening please help what to do if i want to use this in i os7
in ios6 it is working fine.
I'm creating an apple passbook for events, using your library.
It opens fine on my phone and everything but even though I'm using the relevanceDate as it says here (https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW53) to show up on the lock screen, it's not coming up.
I tried with todays date and tomorrows date but still is not coming up on the lock screen.
This is the pass.json
{
"description": "Event Confirmation",
"formatVersion": 1,
"organizationName": "EventTest",
"passTypeIdentifier": "pass.com.eventtest.confirmation",
"serialNumber": "#########",
"teamIdentifier": "######",
"expirationDate": "2017-05-04T23:00:00Z",
"relevantDate": "2017-04-28T07:00Z",
"eventTicket": {
"headerFields": [{
"key": "eventHeader",
"label": "TEST",
"value": ""
}],
"secondaryFields": [{
"key": "nameSecondaryFields",
"label": "Name",
"value": "Federico Giust"
}],
"auxiliaryFields": [{
"key": "locAuxiliaryFields",
"label": "Brixton Academy",
"value": "Brixton, London, UK"
}, {
"key": "startdateAuxiliaryFields",
"label": "Start Date",
"value": "28-04-2017"
}, {
"key": "enddateAuxiliaryFields",
"label": "End Date",
"value": "05-05-2017"
}],
"backFields": [{
"key": "eventBackFields",
"label": "TEST",
"value": "Test Project - Local"
}, {
"key": "locBackFields",
"label": "Brixton Academy",
"value": "Brixton, London, UK"
}, {
"key": "startdateBackFields",
"label": "Start Date",
"value": "28-04-2017"
}, {
"key": "enddateBackFields",
"label": "End Date",
"value": "05-05-2017"
}, {
"key": "eventDescription",
"label": "Description",
"value": "Project Description goes here"
}, {
"key": "eventURL",
"label": "Website",
"value": "https:\/\/www.eventtest.com"
}, {
"key": "eventT&C",
"label": "Terms and Conditions",
"value": "Terms & Conditions"
}]
},
"barcode": {
"altText": "4156452",
"format": "PKBarcodeFormatQR",
"message": "4156452",
"messageEncoding": "iso-8859-1"
},
"backgroundColor": "rgb(255,255,255)",
"foregroundColor": "rgb(000, 000, 000)",
"logoText": "Test Project - Local"
}
How far in advance a passbook is supposed to appear on the lock screen? Am I missing another field?
I already have location services enabled and wallet notifications enabled and it works for other passbooks.
Thanks
Hi,
Could you make releases, even with 0.0.x pattern, so that composer resolve it without cloning the repo. Since your repo is on packagist.org and works great, it would be a nice step.
Thanks.
I've followed all the steps in the readme to get the example.php working. I've added all the certificates correctly as far as I can tell. I'm hosting the whole thing on localhost. Is this a problem?
When I access it on the iPhone it says file cannot be downloaded and when I click on it on my mac, it says the file cannot be opened.
Any advice would be great. Thanks!
Hi
I used your great work to create my own passes. Your PHPs works great if I browse using a desktop PC/Mac (I can download and open the pass!!) but when I reach the same pages (e.g. the "example.php") page I get the "Safari can't download this file" or it does nothing....
Am I missing something?
Thank you for the code, it works perfect!
Under which license this code is licensed?
protected function convertPEMtoDER($signature) {
$begin = 'filename="smime.p7s"';
$end = '------';
$signature = substr($signature, strpos($signature, $begin)+strlen($begin));
$signature = substr($signature, 0, strpos($signature, $end));
$signature = trim($signature);
$signature = base64_decode($signature);
return $signature;
}
Hi there.
First of all, thanks for the plugin and all the work.
I'm trying to put the example working, so I'm accessing the following url:
http://localhost:8080/examples/example.php
Here's the folder configuration:
https://i.gyazo.com/943a8d0c7326c2046e7063c62b79f260.png
Accessing that url, it returns to me:
Error: Could not read the certificate
Any help?
Thanks
Right now the class creates a dir called temp
. I am working on removing this dependency.
Hi! First of all thanks for putting out this code.
Unfortunately I'm having trouble making some passes. Well actually the passes themselves work. The problem is that I never see the background image. The logo and icon appear to work fine; I just don't see the background image.
The images I'm using are within Apple's guidelines insofar as image size, etc.; and addFile() is successful (I check checkError() and it never returns true).
Here's the strange part. In the latest Mountain Lion OS, they added the capability to sync passes over iCloud (so you can get a pass using Safari on your desktop and it will sync it). It shows a preview of the pass when you click on it. That preview (on the desktop) does show my background image. However when I request my pass on my iPhone using Mobile Safari, it too shows a preview of the pass
Using Firefox I tried downloading the .pass files themselves so that I could examine them, in case they weren't being put together correctly. But my background image is there, and all the JSON files look correct (e.g. the manifest.jsonshows the correct SHA1 checksum, etc.)
I have even tried your Starbucks example (completely unmodified except for adding my certificate, Pass ID and Team ID), just in case I was doing something wrong with my code; but even the Starbucks sample never shows a background image.
I must admit I'm a bit stumped. Any ideas as to what might be going on here? Have I actually somehow managed to find a bug in iOS 6? ;-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.