I am trying to implement purchase validation for my app. I see that I can send the purchase receipt to my server to verify with Apple. However, I cannot figure out the correct way to POST the NSData to my URL for validation. Something like this:
public void CompleteTransaction (SKPaymentTransaction transaction) {
var productId = transaction.Payment.ProductIdentifier;
NSUrl receiptURL = NSBundle.MainBundle.AppStoreReceiptUrl;
NSData theData = NSData.FromUrl (receiptURL);
RestRequest request = new RestRequest(validationURL, Method.POST);
request.AddBody(theData); // ??
restClient.ExecuteAsync<bool>((response) =>
{
FinishTransaction(transaction, response.Data);
});
}
Does anyone have an example? I am using RestSharp.
Thanks!
- davevr
OK, found how to do it. The trick was to parse the receipt into a dictionary and then pull the key out of that. Sample code:
Once that is done, you can do the validation on the Apple server. There is lots of sample code on the net for that part.