I'm working on implementing Apple Wallet passes using background push notifications.
My server successfully sends the push notification using APNs. The response from the server is HTTP/2 200, and the device receives the push — I can confirm this from device logs.
However, the device logs show the following error:
"Failed to parse JSON message payload for topic "
"Unable to deserialize JSON message payload"
My payload is below 2 payload.
//string payload = "{"aps":{"content-available":1}}";
string payload = JsonConvert.SerializeObject(new
{
aps = new Dictionary<string, object>
{
{ "content-available", 1 }
}
});
string curlArgs = $"-s -o nul -w \"%{{http_code}}\" " +
$"--data-binary \"{payload}\" " +
$"-H \"apns-topic: {bundleId}\" " +
$"-H \"apns-push-type: background\" " +
$"-H \"apns-priority: 5\" " +
$"-H \"content-type: application/json\" " +
$"-H \"authorization: bearer {jwt}\" " +
$"--http2 https://api.push.apple.com/3/device/{token}";
I’ve confirmed that:
The device has the Wallet pass installed.
The apns-topic header is set to my passTypeIdentifier.
The apns-push-type is background and apns-priority is 5.
Steps to Reproduce:
Install Wallet pass on iOS device.
Send background push to device using the above payload.
Observe the device logs using Console.app or log stream.
See error: unable to deserialize JSON message payload.
Is there a specific payload format expected for Wallet passes? Or any additional fields required in the push payload to avoid this deserialization error?
Selecting any option will automatically load the page