Question

lastPurchaseDate is equal to expitationDate on Sandbox


Badge +2

When testing purchases on Sandbox with StoreKit config specifying a 30 second subscription interval I quite often get an entitlement that has equal latestPurchaseDate and expirationDate therefore rendering it invalid immediately and deadlocking my purchase flow. 
 

Logica::Store::update_state: entitlements: ["base_content_access": <EntitlementInfo: "
identifier=base_content_access,
isActive=false,
willRenew=true,
periodType=PeriodType(rawValue: 1),
latestPurchaseDate=Optional(2022-05-21 13:58:39 +0000),
originalPurchaseDate=Optional(2022-05-21 13:58:39 +0000),
expirationDate=Optional(2022-05-21 13:58:39 +0000),
store=Store(rawValue: 0),
productIdentifier=fivesysdev.logica.renewable_subscription,
isSandbox=true,
unsubscribeDetectedAt=nil,
billingIssueDetectedAt=nil,
ownershipType=PurchaseOwnershipType(rawValue: 0)
>]

Sometimes happen for 5 minute intervals too, but significantly less often. I was fine with this but Apple rejected my app, most probably due to them testing my app on sandbox with low intervals too.

I worked around this by detecting sandbox and equal latestPurchaseDate and expirationDate and then treating it as false negative by acting like entitlement is active, but this seems like a bug.


2 replies

Userlevel 5
Badge +9

Do things work fine on a physical device without a StoreKit config file? Apple doesn’t use StoreKit config files for app review so would be a more representative test to what they’re seeing. Expiration date should only equal purchase date for refunded transactions - were you trying to simulate any refunds? 

Badge +2

@ryan I tested only on physical device. No refunds, just the standard purchase flow: present subscription screen to a user → uses presses “Subscribe” → purchase. I managed to catch the issue only with StoreKit configuration with 30 sec intervals. I did test with network link conditioner and interruptions, also without StoreKit config. I probably missed something and this is not the root of the problem but that behavior seems wrong.

Reply