j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

Problem with store.validator ajax call #245

Closed Daz66 closed 6 years ago

Daz66 commented 9 years ago

Hi,

I've been tearing my hair out with a problem where my server-side purchase validation script is failing. It seems no POST data is actually getting through to my script from the XMLHttpRequest() send in store-android.js I have tested the script using my own jquery call here: $.ajax( { url: store.validator, method: 'POST', data: { receipt: , signature: }, success: function(resp) { alert("success: " + JSON.stringify(resp)); }, error: function(status, message) { alert("Error: " + status + ": " + message); } }); and this works fine!

So my questions is: why does the XMLHttpRequest() POST request in your code fail and yet the jQuery equivalent works?

BTW: the server-side script is an Amazon AWS EC2 instance. I'm not sure if this is significant!

Thanks in advance for any pointers, Daz

bradrlaw commented 8 years ago

I am running into the same issue, the remote validator gets called but no data is sent. I have the plugin in debug mode and no errors / warnings are thrown. It shows the receipt prior to the call even.

nulleof commented 8 years ago

Data is sending with "application/json" content type here. So you need to use in your php script: $data = file_get_contents('php://input'); for getting post variables instead $_POST.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.