tschoffelen / php-pkpass

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

Error creating the pkpass #111

Closed fauVictor closed 2 years ago

fauVictor commented 3 years ago

Reproduce the error

I tried to create the pkpass. For that, I use this json :

const value = {
    "description": "demo pass",
    "formatVersion": 1,
    "organizationName": "Flight Express",
    "passTypeIdentifier": "com.mjmcloud.mjmcloudcarteetudiant", // tried with : pass.com.passtest.mjmcloud
    "serialNumber": "12345678",
    "teamIdentifier": "ABCDEFGH",
    "logoText": "Technomagination",
    "foregroundColor": "rgb(9, 80, 160)",
    "backgroundColor": "rgb(255, 255, 255)",
    "generic": {
        "primaryFields": [
            {
                "key": "name",
                "label": "NAME",
                "value": "Victor FAU"
            }
        ],
        "secondaryFields": [
            {
                "key": "title",
                "label": "\u00c9cole",
                "value": "MJM Graphic Design"
            }
        ],
        "auxiliaryFields": [
            {
                "key": "email",
                "label": "Formation",
                "value": "Motion design"
            },
            {
                "key": "twitter",
                "label": "Ann\u00e9e",
                "value": "2021 - 2022"
            }]
    }
}

The pkpass is return well but I have an error when I want to save it on Apple wallet, I have this error message :

Invalid data error reading pass pass.com.carteetudiant.mjmcloud/12345678. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.

To do that, I have followed those websites :

Documentions I followed

Docs PhpPkpass : https://github.com/flexible-agency/php-pkpass

Building a pass : https://developer.apple.com/documentation/walletpasses/building_a_pass

Create CSR certificate : https://help.apple.com/developer-account/#/devbfa00fef7

create .pem file : https://support.airship.com/hc/en-us/articles/213493603-How-to-use-OpenSSL-to-create-an-Apple-Pass-Type-Certificate OR https://serverfault.com/questions/254627/how-do-i-convert-a-cer-certificate-to-pem

Any idea ?

autech-greg commented 3 years ago

The Team Identifier is incorrect, you need to grab this by logging into your Apple account at https://developer.apple.com/account/ and then checking the Membership tab (Team ID is the value your looking for). The error your receiving is indicating your trying to use the Team Id of 12345678

Invalid data error reading pass pass.com.carteetudiant.mjmcloud/12345678

For the passTypeIdentifier, you must use the one you created for the pass itself, this is the one prefixed with pass. (In your case, pass.com.passtest.mjmcloud). Using an App ID will not work here.

fauVictor commented 3 years ago

Thank you for help, I will try this. I will give a feed back before close this issue.