So, if a user hits "Restore Subscription" I have this script:
if (SKPaymentQueue.canMakePayments()){
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL, FileManager.default.fileExists(atPath: appStoreReceiptURL.path) == false {
let refreshRequest = SKReceiptRefreshRequest()
refreshRequest.delegate = self
refreshRequest.start()
}
else{
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().restoreCompletedTransactions()
}
}Now, if the user has never subcribed before it'll still get a receipt that looks like this:
environment = Sandbox;
receipt = {
"adam_id" = 0;
"app_item_id" = 0;
"application_version" = 10;
"bundle_id" = "xxxxxx";
"download_id" = 0;
"in_app" = (
);
"original_application_version" = "1.0";
"original_purchase_date" = "2013-08-01 07:00:00 Etc/GMT";
"original_purchase_date_ms" = 1375340400000;
"original_purchase_date_pst" = "2013-08-01 00:00:00 America/Los_Angeles";
"receipt_creation_date" = "2018-05-07 23:35:06 Etc/GMT";
"receipt_creation_date_ms" = 1525736106000;
"receipt_creation_date_pst" = "2018-05-07 16:35:06 America/Los_Angeles";
"receipt_type" = ProductionSandbox;
"request_date" = "2018-05-07 23:49:17 Etc/GMT";
"request_date_ms" = 1525736957273;
"request_date_pst" = "2018-05-07 16:49:17 America/Los_Angeles";
"version_external_identifier" = 0;
};
status = 0;That's the whole thing. Comparing this to a receipt from a suscribed sandbox user, there's some missing things. Like "Latest_receipt_info" and "Pendng_renewal_info." I ASSUME that I need to check for "Latest_receipt_info" to determine if they've ever susbribed before so that I can display a message stating such. Is this the right way though?