Hello,
this has nothing to do with b4a, but just in case someone has struggled with this.... I'm trying to validate in-app purchase receipts, from b4a back to Apple, using the following:
Parse.Cloud.define("myBeautifulVerifyReceipt",function(request,response){
var params = request.params;
var receipt = params["receipt-data"];//base64 encoded receipt, using [receipt base64EncodedStringWithOptions:0]
var url = ( request.params.production !== undefined ) ? 'https://buy.itunes.apple.com/verifyReceipt':'https://sandbox.itunes.apple.com/verifyReceipt';
Parse.Cloud.httpRequest({
method: "POST",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength({"receipt-data":receipt})
},
url:url,
body:{
"receipt-data":receipt
}
}).then(function(result){
response.success("ok");
},function(error){
response.error(error.message);
});
});
I always get the following response from apple ----> "data":{"status":21002}, on in other words "The data in the receipt-data
property was malformed or missing."
As anyone managed to validate IAP receipts against the app store using parse api? I can't seem to figure out where the receipt payload should go, or how it should be encoded...