Skip to content

Instantly share code, notes, and snippets.

@objectiveSee
Created September 12, 2013 18:17
Show Gist options
  • Save objectiveSee/6541696 to your computer and use it in GitHub Desktop.
Save objectiveSee/6541696 to your computer and use it in GitHub Desktop.
var post_options = {
host: 'https://buy.itunes.apple.com',
port: '80',
path: '/verifyReceipt',
method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// 'Content-Length': bodyData.length
// }
};
// Set up the request
var post_req = http.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('Response: ' + chunk);
deferred.resolve(purchase);
});
res.on('error', function(err) {
console.error(err);
deferred.reject(err);
})
});
post_req.write(bodyData);
post_req.end();
return deferred.promise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment