Using Google Cloud Functions to Handle Subscription Notifications

I am trying to set up a Google Cloud Function (GCF) to handle Subscription Notifications from Apple. I am familiar with GCF, but not familiar with the Nodejs methods of handling the data Apple sends with the notification. I am receiving the Apple notification, but only a "chunk" of it. Here's my code (using express and body-parser frameworks):


exports.iosNotification = functions.https.onRequest((req, res) => {
    console.log("We are receiving a request from Apple.");
    app.use(bodyParser.json());
    console.log(req.body);


Should I be "listening" to a port? If so, which one? Do I need to concatenate "chunks"? As you can see, I've read about this, but I'm a little lost here.


This is the output I'm getting (which is part of the notification Apple says it is sending):


{ latest_receipt: 'ewoJInNpZ25hdHVyZSIgPSAiQTNVM0FjaDJpbXRPMG53cEtrQW9


But I don't get `notification_type` or any of the other parts of the JSON file.

Answered by T.M. Lynch in 402381022
Accepted Answer
Hi, I'm just now trying to do something similar to what you did getting Google Cloud Functions to work with with Subscription Notifications. I was wondering if you got this working completely and if you could share everything you did. I can't find any tutorials or walk throughs online. If you could share any helpful links or writeup what you did I'd be very very very grateful.

Thanks in Advance!
Using Google Cloud Functions to Handle Subscription Notifications
 
 
Q