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.