iosfirebasesubscriptionserver-to-server

iOS subscriptions server_to_server notifications using firebase


I need to implement server-side logic, to handle changes in apple iOS subscriptions status https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_status_update_notifications

My questions is:

  1. Can I do that with firebase? I.e. can I put some, for example "node.js" code on firebase server, to process messages from apple servers?

  2. When I test firebase db servers with nscurl --ats-diagnostics https://server.com, to check is it compatible with apple ATS (https://developer.apple.com/documentation/security/preventing_insecure_network_connections) it's fail only at TLSv1.3 stuff, is it enough to satisfy apple ats requirements?

Edit 26/11/2020 - Btw I successfully implemented iOS subscriptions with Firebase cloud functions - so Firebase it's a way to go.


Solution

  • Yes, this is possible with Firebase. You'll have to use Cloud Functions. I've only used it with the Sandbox environment, but it looks like they satisfy Apple's ATS requirements since all status updates came through as expected.

    exports.iapStatusUpdate = functions.https.onRequest((req, res) => {
      //all receipt info will be in req.body
    })
    

    After deploying this to cloud functions you'll have to go in App Store Connect -> My Apps -> your app -> App Store -> App information, and enter the url in "Subscription Status URL", which will be something like https://us-central1-[your-project-id].cloudfunctions.net/iapStatusUpdate.