Skip to main content

I’m using `customerInfoStream` for the first time, and I’m a bit confused - in sandbox testing, I’m seeing updates come in reliably each time a subscription renews, and it correctly includes the `activeSubscriptions` along with expiration dates.  If I wait sufficiently, however, I never get an update with an `activeSubscriptions` property that is empty - I simply stop getting updates.

 

I left my app running overnight in the simulator, and in the morning, I was not presented with the paywall as expected.  Looking at my logs, the entry that I received includes the active subscription, from which my app (correctly) surmised that the entitlement was still active.  The next update that I would have expected, with no active subscription, was never delivered.  The time of this last event matches what I see in the console (where I do see ‘Opted out for renewal’)

 

Is this expected?  I can certainly use the provided `expiresDate` to create an event at that time, but it doesn’t seem to me like this would be much better than simply calling `customerInfo` on a timer, which is what I’ve done in the past.

 

Here is my last log entry, if it helps:

 

Received customer info change: <CustomerInfo:

originalApplicationVersion=1,

latestExpirationDate=Optional(2024-10-06 01:04:27 +0000),

activeEntitlements=p"subscribed": "<EntitlementInfo: \"\nidentifier=subscribed,\nisActive=true,\nwillRenew=false,\nperiodType=PeriodType(rawValue: 0),\nlatestPurchaseDate=Optional(2024-10-06 01:04:17 +0000),\noriginalPurchaseDate=Optional(2024-10-06 00:19:03 +0000),\nexpirationDate=Optional(2024-10-06 01:04:27 +0000),\nstore=Store(rawValue: 0),\nproductIdentifier=monthly_999_trial,\nproductPlanIdentifier=null,\nisSandbox=true,\nunsubscribeDetectedAt=Optional(2024-10-06 01:04:20 +0000),\nbillingIssueDetectedAt=nil,\nownershipType=PurchaseOwnershipType(rawValue: 0),\nverification=VerificationResult.notRequested\n>"],

activeSubscriptions=>"monthly_999_trial": "expiresDate: Optional(2024-10-06 01:04:27 +0000)"],

nonSubscriptions=<],

requestDate=2024-10-06 01:04:24 +0000,

firstSeen=2024-10-06 00:15:37 +0000,

originalAppUserId=$RCAnonymousID:d600aa05cb4a400f8710dde3d4c5a103,

entitlements=1"subscribed": "<EntitlementInfo: \"\nidentifier=subscribed,\nisActive=true,\nwillRenew=false,\nperiodType=PeriodType(rawValue: 0),\nlatestPurchaseDate=Optional(2024-10-06 01:04:17 +0000),\noriginalPurchaseDate=Optional(2024-10-06 00:19:03 +0000),\nexpirationDate=Optional(2024-10-06 01:04:27 +0000),\nstore=Store(rawValue: 0),\nproductIdentifier=monthly_999_trial,\nproductPlanIdentifier=null,\nisSandbox=true,\nunsubscribeDetectedAt=Optional(2024-10-06 01:04:20 +0000),\nbillingIssueDetectedAt=nil,\nownershipType=PurchaseOwnershipType(rawValue: 0),\nverification=VerificationResult.notRequested\n>"]

verification=VerificationResult.notRequested

>

 Hi! CustomerInfo is only updated in the SDK when another method is called that results in the info being updated - for example: a purchase occurs, or getCustomerInfo is called, or restoring, etc. We never push data to the client, such as in the case of an expiration, which happens off the device - so you'll need to fetch the data periodically locally, and then, the listener will respond. This is why we recommend calling getCustomerInfo often throughout your app. 


Got it - is there a recommended or viable use case for the `customerInfoStream` field in that case?  It seems redundant if I need to call `getCustomerInfo` throughout the app in order for the `customerInfoStream` to return updated data.

 

Thanks,

M


Reply