Comments (8)
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.
@pepoteloko Thank you , I have solved that issue , my mistake was serial number not same during update the card as creating card
from pushok.
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.
Remember, the certificate must be specifically for wallet, a regular certificate for push notifications will not work!
from pushok.
@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.
app_bundle_id is passTypeIdentifier.
from pushok.
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.
@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)
- BadDeviceTokenThe specified device token was bad. Verify that the request contains a valid token and that the token matches the environment HOT 3
- Support PHP 8
- Uncaught Exception HOT 3
- Package spomky-labs/jose is abandoned, you should avoid using it. Use web-token/jwt-framework instead. HOT 1
- Deprecation notices with PHP 8.1 HOT 4
- send a notification on a chosen date HOT 1
- Updating a badge HOT 1
- Support for creating WeatherKit JWT tokens
- The `Alert` option is set in the code but there is no Alert on the phone
- Package fgrosse/phpasn1 is abandoned HOT 2
- Started getting InvalidArgumentException "Unable to load the key." HOT 4
- Live Activities Supported? HOT 3
- Laravel Vapor - HTTP/2 stream 15 was not closed cleanly before end of the underlying stream HOT 3
- 0.15.x is no longer compatible with PHP 8.0 HOT 4
- HTTP/2 stream was not closed cleanly: REFUSED STREAM HOT 9
- Sending `Alert` as `Background` due to `content-available` set HOT 1
- php 8.0 via command package not installed
- Random "Send failure: Broken pipe" error
- Need to add custome key/value to aps HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushok.