Pregunta

I created a pass via PHP and tried it on the iOS simulator and on my iPhone and everything is working fine.

Now I'm stuck with the task "update my pass" the problem here is that I don't get any payloads back to my Server.

I have a AlphaSSL Cert. on my Server running This is the JSON file for the Pass:

JSON:

{ 
    "passTypeIdentifier": "pass.com.XXXXXXX.musterkarte",
    "formatVersion": 1,
    "organizationName": "Melters Werbeagentur GmbH",
    "teamIdentifier": "XXXXXXXX",
    "serialNumber": "test",
    "backgroundColor": "rgb(240,240,240)",
    "logoText": "Hi, there!",
    "description": "testpass",
    "storeCard": {
        "secondaryFields": [
            {
                "key": "balance",
                "label": "BALANCE",
                "value": "$7.36",
                "changeMessage": "change your balance to %@"
            },
            {
                "key": "name",
                "label": "NICKNAME",
                "value": "hello"
            }

        ],
        "backFields": [
            {
                "key": "id",
                "label": "Card Number",
                "value": "test"
            }
        ]
    },
    "barcode": {
        "format": "PKBarcodeFormatPDF417",
        "message": "test",
        "messageEncoding": "iso-8859-1",
        "altText": "test"
    },
    "locations" : [
        {
            "latitude" : 51.222294,
            "longitude" : 6.792051,
        }
    ],
    "authenticationToken":"72aa48d08db9a379f147e38fb23a3901",
    "webServiceURL":"https://melters-server.com/passbook_update/"

    }

and this is my webservice index.php:

$request = explode("/", substr(@$_SERVER['REQUEST_URI'], 1));



if (strtoupper($_SERVER['REQUEST_METHOD']) === "POST"

    && isset($_SERVER['HTTP_AUTHORIZATION'])

    && strpos($_SERVER['HTTP_AUTHORIZATION'], 'ApplePass') === 0

    && $request[2] === "devices"

    && $request[4] === "registrations") {



    $auth_key = str_replace('ApplePass ', '', $_SERVER['HTTP_AUTHORIZATION']);



    $device_id = $request[3];

    $pass_id = $request[5];

    $serial = $request[6];



    // Catch the JSON post and decode it

    $dt = @file_get_contents('php://input');

    $device_token = json_decode($dt);

    $device_token = $device_token->pushToken;

    if (!$device_token) die('No Token Found'); // Token wasn't found



    $sql="INSERT INTO token (id, token) VALUES (1, '".$device_token."')";



    mysql_query($sql,$link);

    exit;

}

?>

The Problem is after I added a new pass to my phone, the database remains empty.

and I visit

https://www.melters-server.com/passbook_update/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber

then I get this Infos in the Browser:

GET 443 Array ( [0] => passbook_update [1] => version [2] => devices [3] => deviceLibraryIdentifier [4] => registrations [5] => passTypeIdentifier [6] => serialNumber )

¿Fue útil?

Solución

From your comment, it appears that your webServiceURL your server certificate is self signed or the certificate chain cannot be validated.

If I run your cert through this validator, it implies the latter.

In developer options on your test device (Settings->Developer), turn on "Allow HTTP Services" under PassKit Testing and use a HTTP webServiceURL, or alternatively double check the certificate chain for the SSL certificate on your server.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top