GithubHelp home page GithubHelp logo

includable / php-pkpass Goto Github PK

View Code? Open in Web Editor NEW
894.0 894.0 184.0 5.11 MB

💳 PHP class for creating passes for Wallet on iOS.

Home Page: https://includable.com

License: MIT License

PHP 100.00%
ios passbook php php-pkpass pkpass wallet

php-pkpass's People

Contributors

aeoris avatar alexander-schranz avatar antonioreyna avatar artyfarty avatar chao avatar cjnewbs avatar danbrada avatar dator avatar dododedodonl avatar ebetancourt avatar fbrinker avatar fedegiust avatar gcalmels avatar getreup avatar isarphilipp avatar jacksonj04 avatar mac-cain13 avatar mcampo-wework avatar mikealmond avatar netolicak avatar ondrejmirtes avatar philippec avatar piamancini avatar ptz0n avatar rkaiser0324 avatar robertbaelde avatar soukicz avatar tschoffelen avatar ulvesked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-pkpass's Issues

Code has generated pass.pkpass with Zero bytes

Please help me to resolve this.

  1. I've Set the path to my Pass Certificate
  2. I've Set password for certificate
    3.I've Set the path to my WWDR Intermediate certificate
    4.I've set my passTypeIdentifier
    5.I've set my teamIdentifier

What is the point of issue?

screen shot 2017-02-07 at 11 36 21 am

Can't Open pkpass

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.

Passes not sending to or downloading on iPhon

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.

Safari sends "Download Failed" if icon.png is not included

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.

Work around with Zend Framework

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 missing last modified header

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)

Empty .pkpass files

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.

Could not find package pkpass/pkpass

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

Warnings

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

Adding the pass

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 ?

Multiple secondaryFileds

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

Pass Variables

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.

Multiple Passes

Hey, is there any way to return multiple event tickets at once?
Thank's in advance!

Push notification

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.

No support for .p8 files

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.

Error: Could not read the certificate

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.

setJSON() error when using json_encode()

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); ?>

PKPass opens as html on iphone/safari

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.

Warning: openssl_pkcs7_sign(): error opening the file (Windows/IIS/PHP5.3)

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

Composer, PSR

Make PKPass follow at least PSR-0 (PSR-1 would be great, too) and working with composer.

Cant open email attached .pkpass into wallet app in iPhone

Uploading WhatsApp Image 2016-10-18 at 3.32.18 PM (1).jpeg…
Hi,

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?

how to interact with pass? like if I want device id then how can I get device id for pass modification notification ??

Download error

Hi,
safari on iphone with IOS 10.2.1 return me download error.
All certificate and psw are correct.. why?

thanks best regards

PKPass file could not be opened due PHP notice written to file

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

iOS 9: Safari cannot download this file

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!

Broken with iOS7?

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".

Passes not adding to Passbook

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.

Windows installation

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?

after generating pass.pkpass file its not working or not opening in any device

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.

Passbook not showing up in lock screen

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

Could you make some release ?

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'm getting PKPasses of size 0Kb

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!

Safari can't download file on iPhone

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?

License

Thank you for the code, it works perfect!
Under which license this code is licensed?

Change convertPEMtoDER

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;
}

Not seeing background images

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? ;-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.