Skip to content

Instantly share code, notes, and snippets.

@mitchellporter
Created March 17, 2016 04:31
Show Gist options
  • Select an option

  • Save mitchellporter/d8e9384a208fdc0e5bad to your computer and use it in GitHub Desktop.

Select an option

Save mitchellporter/d8e9384a208fdc0e5bad to your computer and use it in GitHub Desktop.
parse cloud function for validating itunes sandbox receipt data
Parse.Cloud.define("verifyReceipt", function(request, response) {
var validationParams = {"receipt-data": request.params.receipt }
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
url: 'https://sandbox.itunes.apple.com/verifyReceipt',
body: validationParams,
success: function(httpResponse) {
response.success(httpResponse.text);
},
error: function(httpResponse) {
response.error('Request failed with response code ' + httpResponse.status);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment