I have implemented Real Time Developer Notifications (RTDN) for my Android App within the Google Developer Console as specified here . In doing so, I made my backend http-functions.js file include a POST section to receive the POST request to which Google sends when purchase activity is performed within my Android mobile app.
I have validated that the connection is correct by sending a test notification from the Google Developer Console, and also when a test user makes a purchase from within the app (which is using v 4.0.0 of the Play Billing API).
However, in both cases, the body of the POST on my back-end is empty. According to the Google docs, it should contain a json block in this format:
{
"message": {
"attributes": {
"key": "value"
},
"data": "eyAidmVyc2lvbiI6IHN0cmluZywgInBhY2thZ2VOYW1lIjogc3RyaW5nLCAiZXZlbnRUaW1lTWlsbGlzIjogbG9uZywgIm9uZVRpbWVQcm9kdWN0Tm90aWZpY2F0aW9uIjogT25lVGltZVByb2R1Y3ROb3RpZmljYXRpb24sICJzdWJzY3JpcHRpb25Ob3RpZmljYXRpb24iOiBTdWJzY3JpcHRpb25Ob3RpZmljYXRpb24sICJ0ZXN0Tm90aWZpY2F0aW9uIjogVGVzdE5vdGlmaWNhdGlvbiB9",
"messageId": "136969346945"
},
"subscription": "projects/myproject/subscriptions/mysubscription"
}
I am getting an empty {} block instead. For example here is the console output I use to see what is being passed to my POST handler within http-functions.js:
console.log("Got a post for sitsubscriptionstatus: " + JSON.stringify(request, null, 2));
And here is the relevant portion of the POST request that I get:
functionName: utils,
path: [
sitsubscriptionstatus
],
url: https://www.stayingintouch.com/_functions/utils/sitsubscriptionstatus,
baseUrl: https://www.stayingintouch.com/_functions,
method: POST,
body: {},
headers: {
host: www.stayingintouch.com,
user-agent: APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html),
transfer-encoding: chunked,
accept: application/json,
accept-encoding: gzip, deflate, br,
authorization: Bearer <LONG ENCODED TEXT STRING HERE>,
cid: ,
content-type: application/json,
from: noreply@google.com,
geoip_country_code: CA,
geoip_country_code3: CAN,
Notice that the body is empty. Is Wix/Velo doing something to strip out the POST body behind the scenes for some reason?