summaryrefslogtreecommitdiff
path: root/platform/iphone/in_app_store.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/iphone/in_app_store.mm')
-rw-r--r--platform/iphone/in_app_store.mm25
1 files changed, 25 insertions, 0 deletions
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 316e619e11..71e95666af 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -167,6 +167,31 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["type"] = "purchase";
ret["result"] = "ok";
ret["product_id"] = pid;
+
+ if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){
+
+ NSURL *receiptFileURL = nil;
+ NSBundle *bundle = [NSBundle mainBundle];
+ if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) {
+
+ // Get the transaction receipt file path location in the app bundle.
+ receiptFileURL = [bundle appStoreReceiptURL];
+
+ // Read in the contents of the transaction file.
+ ret["receipt"] = receiptFileURL;
+
+ } else {
+ // Fall back to deprecated transaction receipt,
+ // which is still available in iOS 7.
+
+ // Use SKPaymentTransaction's transactionReceipt.
+ ret["receipt"] = transaction.transactionReceipt;
+ }
+
+ }else{
+ ret["receipt"] = transaction.transactionReceipt;
+ }
+
InAppStore::get_singleton()->_post_event(ret);
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
} break;