I want to send APN to update a pass in the Wallet app. Followed this guideline. https://developer.apple.com/documentation/walletpasses/adding_a_web_service_to_update_passes#3733254
I tried with Typescript (Firebase Functions) like this.
var path = "/3/device/"+pushToken
var url = "https://api.push.apple.com:443"+path
const response = await fetch(url, {
method: 'POST',
body: null,
headers: {
'apns-topic': 'com.colorfull.walletPass',
'apns-push-type': 'background',
'connection': 'keep-alive'
}
});
Got this error.
TypeError: fetch failed
Tried with Flutter like this.
var path = "/3/device/$pushToken";
var url = "https://api.push.apple.com:443$path";
Response resp = await post(Uri.parse(url), headers: {
'apns-topic': 'com.colorfull.walletPass',
'apns-push-type': 'background',
'connection': 'keep-alive'
}, body: {});
Got this error.
ClientException: Invalid request method, uri=https://api.push.apple.com/3/device/688a3d6bf83526f00f6fb3d8dd197578f665dea0eeba7aebbe68c61f06bad198
Obviously I'm doing it all wrong, but there is no clear guideline. How can I send APN??