Giter VIP home page Giter VIP logo

Comments (8)

pepoteloko avatar pepoteloko commented on May 27, 2024 2

Thanks a lot!!
But after a little fight against certificates and ID's I sent a push notification using this package!

I use an empty alter
$payload = Payload::create()->setAlert("");

And correctly filled my options:

$options = [
   'key_id' => 'XXXX',   // The Key ID obtained from Apple developer account
   'team_id' => 'SUPER_TEAM',   // The Team ID obtained from Apple developer account
   'app_bundle_id' => 'pass.exxample',   // The bundle ID for app obtained from Apple developer account
   'private_key_path' => AuthKey_123456.p8,
   'private_key_secret' => null
];

We create the certificate for push notifications, I did not know that the certificate was different from the one used for the pkpass. We create and download it WITHOUT change the name of the file.
My first try was with "certificate.p8" and fails, but with the original name it works :)

The app_bundle_id, i don't know exactly where to find inside the apple website, I was trying all the codes I found in our code. It was made before I start working on this project.

I hope this helps!

from pushok.

tabrezahmad avatar tabrezahmad commented on May 27, 2024 1

@pepoteloko Thank you , I have solved that issue , my mistake was serial number not same during update the card as creating card

from pushok.

pepoteloko avatar pepoteloko commented on May 27, 2024

Hello, do you have make some advances with this?
I'm in the same situation.
I'm sending notifications to update the pkpass but my device does nothing :(

from pushok.

reskar avatar reskar commented on May 27, 2024

Remember, the certificate must be specifically for wallet, a regular certificate for push notifications will not work!

from pushok.

dee4life2005 avatar dee4life2005 commented on May 27, 2024

@pepoteloko
Unfortunately we didn't have much luck getting the pkpass update push notification to work, despite having the correct certificates etc. It looks like the library should support it, but we just couldn't get it to work - it said the message was accepted by APNS but the device just never received it (or if it did, then it didn't see it as a pkpass update trigger).

We did however manage to get it working by using CURL, with the same payload and cert details.

If you do wish to go down that route, then the snippet of code we used was as follows:

`

$payload = '{}';

$url     = "https://api.push.apple.com/3/device/".$device_token;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_SSLCERT, $cert_file_path);
curl_setopt($ch, CURLOPT_SSLCERTTYPE, "P12");
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $cert_secret);

curl_setopt($ch, CURLOPT_VERBOSE, true);
$streamVerboseHandle = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $streamVerboseHandle);

// Set HTTP Header for POST request

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($payload))
);


$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);


rewind($streamVerboseHandle);
$verboseLog = stream_get_contents($streamVerboseHandle);
error_log('APNS_CURL_DEBUG:'.$verboseLog);

`

from pushok.

reskar avatar reskar commented on May 27, 2024

app_bundle_id is passTypeIdentifier.

from pushok.

tabrezahmad avatar tabrezahmad commented on May 27, 2024

Hi @pepoteloko pepoteloko ,
I am follow same things and get message
63C6E6A3-CE90-701B-83E2-100C94B73DBC
200
Success.

But my wallet pass did not update , can you please help me on this

from pushok.

pepoteloko avatar pepoteloko commented on May 27, 2024

@tabrezahmad Great!! 200: Success the half part is done!
The next important thing to receive a message is to change any value of the pkpass.
To get the better (visually talking) message, only change one value and add a message.

Here I put a little example:

// This array contains all the front fields of the card, latter in the code we generate the json with this
$frontTmpFields[$fields][] = [
      'key' => "key-$countKey",
      'label' => $keyLabel,
      'value' => rand(1, 100), //$keyValue,, I just use a random one to be sure that every time I got a new value.
      'changeMessage' => "The new value is: %@"
];

If you change more than one value, you don't see your message, and a generic one like "Something has changed".
Of course on your iPhone settings you must allow notifications :)

With this every time I send the push notification I see on my phone "The new value is 23", "The new value is 42", ...

from pushok.

Related Issues (20)

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.