transactionCallback: Received event nil

I have a version of my app already in the app store and working, now I have written a version 2 of it. For some reason the in app purchases have stopped working and I’m not sure how/what has changed.

When you click the buy button it triggers the app store buy process which completes successfully. However when the callback is called to my app it comes through as nil every time. It sends through many calls but they’re all nil

To try and see what is going wrong I tried this…

function transactionCallback( event )
print(“TX:” … Json.Encode(event))
which returns …
TX:"?:0: attempt to index field ‘transaction’ (a nil value)"
If anyone has experienced anything like this before I would really appreciate some ideas/advice as I’m currently stuck with a completed app which I can’t released to the app store :frowning:

Cheers,
Scott. [import]uid: 51622 topic_id: 12507 reply_id: 312507[/import]

I’ve confirmed that if I go back to the sample app it successfully purchases my own configured in app product so there is obviously something in my application which is interfering but doesn’t cause an error or failure :frowning: [import]uid: 51622 topic_id: 12507 reply_id: 45725[/import]

No surprise really after all. There was an error in my code in the call back. The only wierd thing was how it was displaying the error showing the event to be nil. If it had shown the error correctly it would have much easier to diagnose. [import]uid: 51622 topic_id: 12507 reply_id: 45835[/import]

Another thing that is worth considering. The app store aggressively calls the call back until you respond. What that means is that it will call many times very quickly until you call store.finishTransaction(id).

In my case I was trying to download files and check if they were all downloaded before calling the finishTx(as recommended in the demo app) however this meant that my function to download the files was being called many times and causing my app to fail.

What I have done now is separate the downloading. I record the tx was successful and then call the finishTx method immediately. Then I call the download files function to run so it can run without getting called many times quickly. When the client tries to access the product it checks if all the files have downloaded for all the products they own and then asks them to wait if they haven’t and completes the downloads.

Just thought I’d share :slight_smile:
[import]uid: 51622 topic_id: 12507 reply_id: 45837[/import]

Another thing - even when the tx event is correct Json.Encode fails so you have to just print the individual values. [import]uid: 51622 topic_id: 12507 reply_id: 45879[/import]