I am implementing IAP into my app and have started using the server notifications. I am wondering is apple offer sometype of dashboard where I can see the history of past attempted notifications just like google and stripes webhook dashboards?
Thanks
There isn't any dashboard to see notifications, but If a notification failed because your server didn't handle it or returned a status code other than 200, then Apple retires 3 times.
If the App Store server doesn’t receive a 200 response from your server after the initial notification attempt, it retries [...] at 6, 24, and 48 hours after its initial attempt.
Source: https://developer.apple.com/documentation/appstoreservernotifications/your_server
Related
I'm trying to implement handling of In-App purchase refund notification (App Store sends responseBody JSON data to server notification url typed by the app developer) in our server backend. But after getting successful refund of In-App purchase, I'm unable to get any notification from the App Store.
Here's the list of things that I did to handle refund notification in our server.
Goto App Store Connect > Type "App Store Notification Url" : "https://ourServerUrl/notifyRefund" (supports TLS 1.2)
Our server accepts 'POST' request and defines #RequestBody parameter as documented in responseBody
Purchase product ('Consumable') from our iOS App (about $0.99) - purchase_date = 2021-03-03
Goto reportaproblem.apple.com and request a refund. -> Next day the refund was processed by App Store and I got $0.99 refunded successfully to my bank account. refund_date = 2021-03-04
After doing above steps I'm still unable to get a notification from App Store.
I read a post about notification delay but I'm not sure if this is because of the delay or my server configuration has a problem.
Apple doc.
Update as of 2021-03-24
In Server <--> App (iOS/Android) communication,
our server's view resolver (ContentNegotiatingViewResolver) determines the default view (TextPlainView, JsonView)
based on the request header (Content-Type, Accept)
Since the apple notification callback response (request to our server)
does not have 'Accept' header, our server sets default view resolver as TextPlainView
following our server configuration in 'servlet-context.xml'
It has caused errors since Apple notification response is in Json format.
After changing our server default view setting as json view
we were able to parse apple notification responseBody.
I hope it helps developers dealing with similar problems.
We are using Amazon SNS as a solution to deliver notifications to 4 of our mobile app's - for each app we have both a GCM as APNS app created in SNS. We've enabled the delivery status loggin for each app both on GCM as APNS (100%). And for all these app's we have received successfull and failure requests in cloudwatch, on top of this we've created a monitoring solution that is querying on the correlated cloudwatch logs.
A few weeks back we noticed that we where missing the delivery logging for all Apple applications - from a certain date no logs where received. We've enabled it again, received logs and now a few weeks later it's disabled again.
Initially we thought the "Apple" applications lost their Delivery Tracking options with renewing the yearly certificate. But we did a test (re-upload the cert) and that did not adapt the delivery failure tracking.
We did a query on CloudTrail on the event "SetPlatformApplicationAttributes" but no events popped up - besides our tests.
At this point in time we have no clue why it keeps getting disabled.
Are we missing some critical info? Is it normal that for Apple apps the delivery tracking is disabled after x-amount of time? What are best-practices for setting this up?
I have an iOS app that receives notification from APNS. If my user deletes the app there is no way for the backend to know the app is not installed on a certain device(device token). In this case what error code will be generated when trying to push via APNS, so that i can remove the entry from the database?
There is a Provider (Your backend server) API introduced by Apple in WWDC-2015 & enhanced in 2016 to give more valuable feedback to the server about the push notification. Here is a transcript to that WWDC session.
From the transcript: "If a device token has been removed, you will get an HTTP/2 response with status 410, or "removed."
It will have a time stamp in payload indicating when APNS last learned that the device token has been removed."
APNS Server Response Codes
200 Success
400 Bad request
403 There was an error with the certificate or with the provider
authentication token.
405 The request used a bad :method value. Only POST requests are
supported.
410 The device token is no longer active for the topic.
413 The notification payload was too large.
429 The server received too many requests for the same device token.
500 Internal server error
503 The server is shutting down and unavailable.
Now what I cannot confirm to you is that if iOS removes the device token if app is removed or if notification setting is turned off from App settings without deleting app.
"410 does mean the app was uninstalled. The token will remain active if the user disables notification alerts in the app settings. The device will still receive the notification, even if no alert is shown to the user. The server will not know if the user has turned off notification alerts. Only the app knows this."
Thanks to Marcus Adams for clartfying this doubt.
Here goes the Apple Developer Guide!!!
If required, Here is a Paid SDK that can help you with uninstallation tracking.
I'm testing Apple push notifications for our iPhone app. The app deployment target is 6.1 and the iPhone is running 7.1.1. We use Apigee as our push notification provider. The phone receives notifications when it's online via cellular and wi-fi, confirming that registration is correct on the app side and Apigee side. I turn on Airplane mode, push a notification from Apigee, wait 3 minutes, take the phone out of Airplane mode, and the phone never receives the push notification. I wait a few minutes (up to 30), then push another notification from Apigee and the phone receives the notification.
I've read Apple's Local and Push Notification Programming Guide and I've read Technical Note TN2265 Troubleshooting Push Notifications.
According to the troubleshooting guide, "Any push notification that isn't delivered immediately was queued for future redelivery because your device was not connected to the service. "Immediately" of course needs to take latency for your connection into account. Outlying cases would be beyond 60 seconds as APNs will time out at that point." This is why I wait 3 minutes. I also know that APNS queues a single message and I think I know that I'm not overwriting that message - unless latency/throughput with the APNS QoS queue is much worse than a few minutes.
In Apigee, in Message History, I see the notification that was sent when the phone was offline. It has a status of Finished with total sent: 1, total errors: 0. I also see a receipt under Data/receipts. This seems to indicate Apigee successfully sent the notification to APNS (but I'm not 100% sure). I verified that the notifierId from Apigee is the same for all notifications sent when online and offline.
Is there any technique I can use to see why the notification is not being delivered from APNS? Is there anything else I can check?
You are correct, if the Notification is showing no errors and a Receipt has been created, the message was properly delivered to APNS.
The only thing I can think of outside of any vagaries of APNS itself that can affect your delivery is if you set the "expire" property on your Notification. Have you tried to see if that makes any difference to your result?
I am building a very simple messenger app just to get my feet wet with this type of app. The general idea that I came up with is: Client 1 types a message, sends to client 2. Message goes to my tcp/http server, then the message is sent to Client 2. I am not sure however how this last step happens.
How can the server locate the phone and push the message to it? Should the app check every few seconds to see if they have a message waiting? How would you do this if the app is suspended (background)?
Would this qualify under background fetch under UIBackgroundModes?
The app regularly downloads and processes small
amounts of content from the network.
You can do it remote push notifications using apple's APN (apple push notification). Essentially, once the server receives the http/tcp message, it has to do a push notification to the device 2 thru apple's apn server. More information here