tschoffelen / php-pkpass

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

associatedStoreIdentifiers, appLaunchURL error #133

Closed tteongi closed 11 months ago

tteongi commented 1 year ago

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

hello. I am using this library very well, thankfully.

I'm not good at English, so I'm asking a question using Google Translator. Please understand if the grammar is incorrect.

When using the library and entering the two data below, the created path does not open. associatedStoreIdentifiers, appLaunchURL

Could you please let me know if that part is not supported?

tschoffelen commented 1 year ago

Hi there! This library saves the payload as JSON, without any further processing, so anything that is described in Apple's JSON payload documentation should work with this library.

tteongi commented 1 year ago

Thanks for your reply. The code below is the code I am currently using.

The type is store card.

I don't know what I'm doing wrong. Can you provide sample code? Of course, I would like the code to include associatedStoreIdentifiers .

The error occurs when appLaunchURL, AssociatedStoreIdentifiers are enabled.

    $data = [
        "formatVersion"         => 1
        , "passTypeIdentifier"  => $this->passTypeIdentifier
        , "teamIdentifier"      => $this->teamIdentifier
        //, "relevantDate"        => date("Y-m-d\TH:i:sP")

        , "serialNumber"        => $passObjects["pass_unique"]
        , "groupingIdentifier"  => $passObjects["pass_group_code"]

        , "backgroundColor"     => $passObjects["tpl_bg_color"]
        , "foregroundColor"     => $passObjects["tpl_text_color"]
        , "labelColor"          => $passObjects["tpl_text_color"]

        , "description"         => $passObjects["pass_description"]
        , "organizationName"    => $passObjects["pass_organization"]

        , "webServiceURL"       => $passObjects["pass_service_url"]
        , "authenticationToken" => $passObjects["pass_auth_token"] // The token must be 16 characters or longer.

        // , "appLaunchURL"               => "http://www.istarbucks.co.kr/msr/index.do"
        // , "associatedStoreIdentifiers" => "466682252"

    ];
tschoffelen commented 1 year ago

I can't give too much support on the Apple side of things unfortunately, but looking at the documentation, it states:

associatedStoreIdentifiers - array of numbers

So I think those lines need to look more like this:

"appLaunchURL" => "http://www.istarbucks.co.kr/msr/index.do",
"associatedStoreIdentifiers" => [466682252]

I also am not sure if there's a limitation on needing to an app that exists in the same developer account. The docs don't seem to mention it, but I could imagine that being the case, as I guess Apple doesn't want to allow anyone to give out passes that link to a specific app.