Reputation: 4975
I am currently testing my in-app subscription purchase in the sandbox mode. If you have ever done this, I sympathize with you.
I am getting a very weird Apple Receipt back when I try to validate my purchase. Somehow the expires_date
on my purchase is earlier in time compared to the purchase_date
. This obviously cannot be, a subscription cannot expire before it was bought... I am just wondering if anyone has ever experienced this. Im hoping it's some funky apple sandbox bug.
If during the subscription period i restart the application and request the receipt, I get the correct one with incrementing subscriptions. Once I put the application in background and bring back to foreground, request receipt, I get a totally different receipt with erroneous expires_date
.
Here is the good receipt I get after two subscription renewals, I had to restart the app to get this...
"latest_receipt_info" = (
{
"expires_date" = "2014-07-16 20:57:28 Etc/GMT";
"expires_date_ms" = 1405544248000;
"expires_date_pst" = "2014-07-16 13:57:28 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2014-07-16 20:54:29 Etc/GMT";
"original_purchase_date_ms" = 1405544069000;
"original_purchase_date_pst" = "2014-07-16 13:54:29 America/Los_Angeles";
"original_transaction_id" = 1000000117061189;
"product_id" = "com.test.subscription";
"purchase_date" = "2014-07-16 20:57:40 Etc/GMT";
"purchase_date_ms" = 1405544260063;
"purchase_date_pst" = "2014-07-16 13:57:40 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000117061189;
"web_order_line_item_id" = 1000000028408117;
},
{
"expires_date" = "2014-07-16 21:00:28 Etc/GMT";
"expires_date_ms" = 1405544428000;
"expires_date_pst" = "2014-07-16 14:00:28 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2014-07-16 20:56:35 Etc/GMT";
"original_purchase_date_ms" = 1405544195000;
"original_purchase_date_pst" = "2014-07-16 13:56:35 America/Los_Angeles";
"original_transaction_id" = 1000000117061189;
"product_id" = "com.test.subscription";
"purchase_date" = "2014-07-16 20:57:40 Etc/GMT";
"purchase_date_ms" = 1405544260063;
"purchase_date_pst" = "2014-07-16 13:57:40 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000117061258;
"web_order_line_item_id" = 1000000028408116;
}
);
receipt = {
"adam_id" = 0;
"application_version" = "1.99.9";
"bundle_id" = "com.test.company";
"download_id" = 0;
"in_app" = (
{
"expires_date" = "2014-07-16 20:57:28 Etc/GMT";
"expires_date_ms" = 1405544248000;
"expires_date_pst" = "2014-07-16 13:57:28 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2014-07-16 20:54:29 Etc/GMT";
"original_purchase_date_ms" = 1405544069000;
"original_purchase_date_pst" = "2014-07-16 13:54:29 America/Los_Angeles";
"original_transaction_id" = 1000000117061189;
"product_id" = "com.test.subscription";
"purchase_date" = "2014-07-16 20:54:33 Etc/GMT";
"purchase_date_ms" = 1405544073000;
"purchase_date_pst" = "2014-07-16 13:54:33 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000117061189;
"web_order_line_item_id" = 1000000028408117;
}
);
"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_type" = ProductionSandbox;
"request_date" = "2014-07-16 20:57:40 Etc/GMT";
"request_date_ms" = 1405544260075;
"request_date_pst" = "2014-07-16 13:57:40 America/Los_Angeles";
};
status = 0;
}
and here is the bad receipt I start getting when I put the app in BG and then FG...
"latest_receipt_info" = (
{
"expires_date" = "2014-07-15 19:44:07 Etc/GMT";
"expires_date_ms" = 1405453447000;
"expires_date_pst" = "2014-07-15 12:44:07 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2014-07-15 19:41:08 Etc/GMT";
"original_purchase_date_ms" = 1405453268000;
"original_purchase_date_pst" = "2014-07-15 12:41:08 America/Los_Angeles";
"original_transaction_id" = 1000000116920864;
"product_id" = "com.test.subscription";
"purchase_date" = "2014-07-16 21:23:55 Etc/GMT";
"purchase_date_ms" = 1405545835331;
"purchase_date_pst" = "2014-07-16 14:23:55 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000116920864;
"web_order_line_item_id" = 1000000028402326;
}
as you can see the purchase_date
is actually in the future if you compare it to the expires_date
... what is this whichery?!
Any help would be appreciated!
Upvotes: 1
Views: 2172
Reputation: 1530
Whilst at the time of purchase of any IAP, the purchase_date will show just that, afterwards it will show the date / time or the restoration of the receipt.
If you wish to get the actual purchase date, use the original_purchase_date field. If you look in the receipts you are showing, you will see this then looks correct.
In short, you must use the original_purchase_date field to get the time/date of the actual original transaction.
Upvotes: 1