Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 863
Torello Avatar asked Jun 25 '19 11:06

Torello


People also ask

How to enable cloud messaging in Firebase app development?

Inside your project in the Firebase console, select the gear icon, select Project Settings, and then select the Cloud Messaging tab. In APNs authentication key under iOS app configuration , click the Upload button.

How do I enable push notifications on Firebase?

Make sure you also select Push Notifications in the service check box. Head back to your Firebase panel and, under Project Settings, select the Cloud Messaging tab. Under APNs Authentication Key within the iOS app configuration, click the Upload button. Now upload the APNs auth key you downloaded from the Apple Developer Portal.

How do I set up Firebase authentication for my iOS app?

In APNs authentication key under iOS app configuration, click the Upload button. Browse to the location where you saved your key, select it, and click Open. Add the key ID for the key (available in the Apple Developer Member Center) and click Upload. Initialize Firebase in your app

How do I add APNs to my Firebase app?

If you don't already have an APNs authentication key, see Configuring APNs with FCM. Inside your project in the Firebase console, select the gear icon, select Project Settings, and then select the Cloud Messaging tab. In APNs authentication key under iOS app configuration, click the Upload button.


1 Answers

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.

like image 185
Pietro Degrazia Avatar answered Oct 09 '22 03:10

Pietro Degrazia