Android IAP Not Posting Variables to Server Correctly

I had a user reach out to me about their subscription purchase. They made one successfully, but it did not show up in my ledger. So, I went to my tablet to test the purchase process and I discovered that the Android block is not returning post variables. Here is my block (broken up in order):

I have no idea why Android is not returning anything for the variables in the last series of blocks there. It should post the device_id, device_type, etc. back to my server, but the server error log shows that they are coming back undefined. Did something change on how this information comes back during the IAP call? I’m pulling my hair out now…

1 Like

And, for the record, I know the purchase IS working because I am getting orders charged in Android AND the subscription_purchase_status is coming back as 1. So, I can tell it is working. I just don’t know why the variables are no longer posting like they were. Did the JSON conventions change?

1 Like

I am going to move away from the subscription model, cut all of the stuff out that I pay extra for, and just make my app a free, ad-supported app. I can’t chase all of these changes all of the time. It’s such a headache. I can make a test app to work on testing IAP stuff, but not with this app. I’m tired of fighting all of the changes. My app should be simple and I’ll make it that way.

4 Likes

@cassandra @wei

Were there any changes to the iap docs or the way data is returned as part of this latest upgrade for android?

@ronnie when you say “variables aren’t posting” can you talk more about what you mean?

Have you just tried posting the response from the first api call to see the actual structure being returned? Debugging will be key here to understanding where the logic is breaking down

2 Likes

@jared if you look at my blocks, once I have cleaned up the purchaseToken, I post everything to my subscription purchase script. This script takes all of the data from the purchase, stores it in my database as a ledger entry, and then validates the purchase. These are the requirements I’ve found from Google and Apple. There has to be a way to track all of the purchases. When I say they aren’t posting, it’s because my server throws errors telling me that all of the post variables are undefined, meaning they were null and never made it to the server.

1 Like

@jared I’ve bookmarked your guide and I will work through it when I have a chance. I’m a LAMP stack guy, so I have plenty of PHP and MySQL experience but no Firebase experience. I’ll get fluent on that way of doing things and check it out. I’ve used the last two summers to work on updating with the changes because that’s really the only time I have the free time to. This is a hobby for me, so I hop in and do what I can when I can. I’ll dumb down my aurora app a bit and see what I can work on moving forward. I can cut quite a bit of cost by cutting things I would consider vanity from my app/server.

1 Like

you probably can do a lot of it for free from firebase. their serverless functions are a lifesaver frfr. digital ocean is another option BUT i’m a serverless kinda guy most of the time

1 Like

My biggest costs (outside of business fees) was collecting weather/cloud data (~$60/month) and astronomical (sun/moon) data/times (~$28/month). So, over $1K/year for stuff I don’t think anyone really needs or uses. So, at this point, I just shut it all down, get the app back to what it was in the beginning (quick, reliable data) and press on. It’s been a good project, but I need less headaches.

I’m setting up another app just to play around with Firebase and all of the other stuff. I am used to having/maintaining a server, so this cloud stuff is all new (and exciting) to me!

2 Likes