Question

expirationDateMillis and originalAppUserId returned by Revenue Cat is wrong

  • 14 September 2023
  • 2 replies
  • 57 views

Badge +2

I am buying a subscription on a device connected to my computer. The expirationDateMillis returned by the SDK is wrong. It is the same date the subscription was done. According to the docs, shouldn't this be the date, when the subscription expires?


Looking at this

"originalPurchaseDate": "2023-05-08T13:11:37Z",
"expirationDate": "2023-09-13T07:00:58Z"
 

this is wrong. TheoriginalPurchaseDate should be Sep 13 2023 (when I subscribed) and theexpirationDate should be a month ahead in the future (thus Oct 13 2023). Additionally, originalAppUserId is "$RCAnonymousID:5933b0b7733a400fbc2f60b38733a23f" eventhough I do a await Purchases.logIn(userId);. I expect that to be my Apps user id?!

try {
await Purchases.logIn(userId);
const {customerInfo} = await Purchases.purchasePackage(pckage);
const activeEntitlementInfo =
customerInfo.entitlements.active[
REVENUE_CAT_SUBSCRIPTIONS_ENTITLEMENT_IDENTIFIER
];
if (typeof activeEntitlementInfo !== 'undefined') {
const {expirationDateMillis, productIdentifier, isActive} =
activeEntitlementInfo;
console.log(expirationDateMillis) // logs the date when the subscription was done

if (isActive) {
if (productIdentifier === PRODUCT_IDENTIFIER_SUBSCRIPTION_MONTHLY) {
...
}
if (productIdentifier === PRODUCT_IDENTIFIER_SUBSCRIPTION_YEARLY) {
...
}
} else {
...
}
}
} catch (e) {
if (!e.userCancelled) {
...
}
}
 

This is how activeEntitlementInfo looks like.

{
"allExpirationDates": {
"next_functionality": null,
"mapview_subscription_monthly": "2023-09-13T06:30:15Z",
},
"originalAppUserId": "$RCAnonymousID:5933b0b7733a400fbc2f60b38733a23f",
"originalPurchaseDate": "2013-08-01T07:00:00Z",
"nonSubscriptionTransactions": [
{
"purchaseDateMillis": 1694534062000,
"productId": "next_functionality",
"productIdentifier": "next_functionality",
"transactionIdentifier": "6d71fc2f78",
"purchaseDate": "2023-09-12T15:54:22Z",
"revenueCatId": "6d71fc2f78"
},
{
"productId": "next_functionality",
"transactionIdentifier": "e5217faf83",
"revenueCatId": "e5217faf83",
"purchaseDate": "2023-09-12T16:09:00Z",
"productIdentifier": "next_functionality",
"purchaseDateMillis": 1694534940000
},
{
"transactionIdentifier": "11b921a3cc",
"productIdentifier": "next_functionality",
"productId": "next_functionality",
"purchaseDateMillis": 1694574375000,
"purchaseDate": "2023-09-13T03:06:15Z",
"revenueCatId": "11b921a3cc"
}
],
"allPurchaseDates": {
"next_functionality": "2023-09-13T03:06:15Z",
"mapview_subscription_monthly": "2023-09-13T06:25:15Z",
},
"managementURL": "https://apps.apple.com/account/subscriptions",
"allPurchaseDatesMillis": {
"next_functionality": 1694574375000,
"mapview_subscription_monthly": 1694586315000,
},
"entitlements": {
"all": {
"Subscriber": {
"billingIssueDetectedAtMillis": null,
"expirationDateMillis": 1694586615000,
"expirationDate": "2023-09-13T06:30:15Z",
"unsubscribeDetectedAtMillis": null,
"billingIssueDetectedAt": null,
"originalPurchaseDateMillis": 1683551497000,
"latestPurchaseDateMillis": 1694586315000,
"isSandbox": true,
"productIdentifier": "mapview_subscription_monthly",
"periodType": "NORMAL",
"store": "APP_STORE",
"identifier": "Subscriber",
"isActive": true,
"unsubscribeDetectedAt": null,
"willRenew": true,
"ownershipType": "PURCHASED",
"latestPurchaseDate": "2023-09-13T06:25:15Z",
"originalPurchaseDate": "2023-05-08T13:11:37Z"
}
},
"active": {
"Subscriber": {
"originalPurchaseDate": "2023-05-08T13:11:37Z",
"latestPurchaseDate": "2023-09-13T06:25:15Z",
"expirationDate": "2023-09-13T06:30:15Z",
"expirationDateMillis": 1694586615000,
"billingIssueDetectedAt": null,
"unsubscribeDetectedAtMillis": null,
"identifier": "Subscriber",
"isActive": true,
"store": "APP_STORE",
"unsubscribeDetectedAt": null,
"periodType": "NORMAL",
"originalPurchaseDateMillis": 1683551497000,
"billingIssueDetectedAtMillis": null,
"ownershipType": "PURCHASED",
"willRenew": true,
"latestPurchaseDateMillis": 1694586315000,
"isSandbox": true,
"productIdentifier": "mapview_subscription_monthly"
}
}
},
"latestExpirationDate": "2023-09-13T06:30:15Z",
"allExpirationDatesMillis": {
"next_functionality": null,
},
"originalPurchaseDateMillis": 1375340400000,
"requestDateMillis": 1694586333317,
"activeSubscriptions": [
"mapview_subscription_monthly"
],
"originalApplicationVersion": "1.0",
"firstSeenMillis": 1694533273000,
"firstSeen": "2023-09-12T15:41:13Z",
"allPurchasedProductIdentifiers": [
"next_functionality",
"mapview_subscription_monthly"
],
"latestExpirationDateMillis": 1694586615000,
"requestDate": "2023-09-13T06:25:33Z"
}
 
  1. Environment
    1. Platform: iOS
    2. SDK version: "react-native-purchases": "^6.6.5",
    3. OS version: iOS 16.4
    4. Xcode/Android Studio version: XCode 14.3.1
    5. React Native version: "react-native": "0.71.7",
    6.  

Why is the expirationDateMillis wrong and why is it assigning not the Apps user id?


2 replies

Userlevel 5
Badge +9

Hey @Christoph ,

Just noticed this post wasn’t resolved, are you still seeing this issue?

About the expirationDateMillis being wrong, that should just come straight from Apple. Did you try restoring purchases to sync everything again? Sometimes in sandbox testing because the subscriptions are so short it may help to sync purchases. This usually isn’t an issue in production because RevenueCat has much more time to fetch new data from Apple but sandbox can sometimes be a little quick.

About the app user ID, the originalAppUserID is the app user ID that was originally generated. When you call login, that will frequently alias the user ID that you provided with the original generated user ID. This just means that these user IDs refer to the same customer record in RevenueCat. It’s common to see this if you allow users to make purchases without logging in. If you require users to login to make a purchase, check out this guide to learn how to reduce the amount of anonymous user IDs: 

 

Badge +2

The expirationDateMillis is expected behaviour in a Sandbox environment, see this https://www.revenuecat.com/blog/engineering/the-ultimate-guide-to-subscription-testing-on-ios/#h-ios-testing-in-sandbox.

Thanks for your reply!

Reply