tschoffelen / php-pkpass

💳 PHP class for creating passes for Wallet on iOS.
https://includable.com
MIT License
908 stars 187 forks source link

Always getting the error "The passTypeIdentifier or teamIdentifier provided may not match your certificate" #95

Closed navane closed 4 years ago

navane commented 4 years ago

Expected Behavior

Open the pkpass file in iPhone as expected

Actual Behavior

Pkpass file generated. But when try to open in iphone, it is showing "Unable to Add. This file cannot be added to Passbok"

Steps to Reproduce the Problem

  1. I have configured the PKpass file manually (Not using composer).
  2. I have configured .p12 location, passTypeIdentifier, teamIdentifier as required (From Apple development tool)
  3. When I try to execute my example.php file, pass.pkpass file generated. But cannot open in iPhone. Also when I try to debug using console, I am getting "Invalid data error reading pass pass.com.xx.xxxxx/12345678. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified". But I have configured the value which pulled from development tool
    1. Do I need to replace AppleWWDRCA.pem with my .pem file? or this will be deafult irrespective of any developer account?

Please help to resolve my problem.

tschoffelen commented 4 years ago

Hi there! No need to replace the AppleWWDRCA.pem, you need both that global certificate, as well as your own certificate.

Please double check your passTypeId and teamId, and try to re-create your personal certificate from the steps in the README. I've had cases where the first time downloading the certificate would not work, but repeating that action a second time would. Seems like it might be a bug in the Apple Developer portal.

navane commented 4 years ago

Thanks for replying back. When I checking README.md https://github.com/tschoffelen/php-pkpass/blob/master/README.md and example.php https://github.com/tschoffelen/php-pkpass/blob/master/examples/example.php

There were no information about changing own pem file.

Am I missing something still?

tschoffelen commented 4 years ago

Check out the 'Requesting the Pass Certificate' section: https://github.com/tschoffelen/php-pkpass/blob/master/README.md#requesting-the-pass-certificate

navane commented 4 years ago

Actually I am a server end(PHP) developer and implementing this feature for iPhone App. iOS developers has shared .p12 file, .pem file, passTypeIdentifier and teamIdentifier to me.

So I have configured the same at server end. Where I need to configure my own pem file other than AppleWWDRCA.pem in code level?

tschoffelen commented 4 years ago

https://github.com/tschoffelen/php-pkpass#getting-the-examplephp-sample-to-work

navane commented 4 years ago

Thank you. Unfortunately I didn't get, where I have to place my own .pem file by referring example.php file?

navane commented 4 years ago

I have added my own .pem file using below code in example.php file. But no luck. $pass->setWWDRcertPath(DIR . "/mydirectory/custom.pem"); So currently I am running with "AppleWWDRCA.pem" which already there in Certificate folder (Code was inbuilt in PKPass.php file) and "custom.pem" which I manually created from development tool.

tschoffelen commented 4 years ago

As described in the documentation, you need to add the path to your .p12 file in the PKPass class constructor. No need to do anything with a PEM file or to edit the WWDR cert path.

emptybox commented 4 years ago

I have added my own .pem file using below code in example.php file. But no luck. $pass->setWWDRcertPath(DIR . "/mydirectory/custom.pem"); So currently I am running with "AppleWWDRCA.pem" which already there in Certificate folder (Code was inbuilt in PKPass.php file) and "custom.pem" which I manually created from development tool.

Were you able to get this working @navane? I'm using php and was able to successfully create the pass and add to the passbook both on simulator and device. I also manually added the PKPass.php file like you. Let me know if I can help.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.