Skip to content

[SANDBOX] Testing with low subscription interval latestPurchaseDate is often equal to expirationDate rendering entitlement inactive #1597

Description

@ZeeWanderer

Describe the bug
When testing purchases in sandbox with 30 second subscription intervals latestPurchaseDate is often equal to expirationDate making entitlement inactive on purchase. Usually, this problem corrects itself on the next subscription tick. Since this does not happen in production or on higher subscription intervals (thou it does sometimes happen on 5-minute intervals but significantly less often) i was content to leave it be, but Apple rejected my app due to this bug. I am not completely sure it was exactly this but it seems like they are testing with low subscription intervals and do not wait 30-60 seconds for the next tick. I worked around this by detecting specific circumstances and treating entitlement as false negative but in my opinion, this is a bug.

Example of such entitlement:

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)
>]
  1. Environment
    1. Platform: iOS
    2. SDK version: 4.3.0
    3. StoreKit 2 enabled (Y/N): N
    4. OS version: iOS 15.5
    5. Xcode version: 13.4 (13F17a)
  2. RevenueCat_only.log Full.log
    1. Use StoreKit config with 30 second subscription interval
    2. Debug an app with said config and test subscribtion flow a few times until you get an entitlement with latestPurchaseDate equal to expirationDate

Additional context
I am using customerInfoStream to listen to changes.

for await customer_info in Purchases.shared.customerInfoStream
{
        debug_print("Logica::Store::listen_for_updates: new customerInfo recieved")
        await update_state(customer_info)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions