Created
March 17, 2016 04:31
-
-
Save mitchellporter/d8e9384a208fdc0e5bad to your computer and use it in GitHub Desktop.
parse cloud function for validating itunes sandbox receipt data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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