question

AlexRudak-7345 avatar image
0 Votes"
AlexRudak-7345 asked RoyLi-MSFT commented

Problems while checking if user purchases a subscription: empty array for appLicense.AddOnLicenses, weird extra sku object for product

Hi, I'm trying to add subscriptions to my app. And I have problems while checking if the user purchases a subscription. I have 2 problems:
1. Method CheckIfUserHasSubscriptionAsync() from documentation always return empty array after I bought a subscription (I tested either with and without trial). I can see that product has property "IsInUserCollection":true when calling method GetSubscriptionProductAsync(), but appLicense.AddOnLicenses inside CheckIfUserHasSubscriptionAsync() is always empty.
2. Method GetSubscriptionProductAsync() returns strange response with 1 extra sku.

In the documentation in the code comment it is written:

// Check if the first SKU is a trial and notify the customer that a trial is available.
// If a trial is available, the Skus array will always have 2 purchasable SKUs and the
// first one is the trial. Otherwise, this array will only have one SKU.

But actually I have always 3 purchasable SKUs after purchasing a product. And weird thing is that SKU that has the property "IsInUserCollection": true doesn't have any SubscriptionInfo:

[
  {
    "StoreId": "9NJJSGSS23P8",
    "IsInUserCollection": true,
    "Title": "1 год подписки",
    "ProductKind": "Durable",
    "Price": {
      "CurrencyCode": "USD",
      "FormattedPrice": "79,99 $",
      "FormattedBasePrice": "79,99 $",
      "FormattedRecurrencePrice": "79,99 $",
      "IsOnSale": false,
      "SaleEndDate": "9998-12-30T03:00:00.0000000"
    },
    "HasDigitalDownload": false,
    "InAppOfferToken": "OneYearSubscriptionWithTrialFinal",
    "Skus": [
      {
        "StoreId": "9NJJSGSS23P8/0100",
        "Title": "1 год подписки",
        "IsInUserCollection": false,
        "IsTrial": false,
        "Price": {
          "CurrencyCode": "USD",
          "FormattedPrice": "79,99 $",
          "FormattedBasePrice": "79,99 $",
          "FormattedRecurrencePrice": "79,99 $",
          "IsOnSale": false,
          "SaleEndDate": "9998-12-30T03:00:00.0000000"
        },
        "CollectionData": null,
        "IsSubscription": true,
        "SubscriptionInfo": {
          "BillingPeriod": 1,
          "BillingPeriodUnit": "Year",
          "HasTrialPeriod": false,
          "TrialPeriod": 0,
          "TrialPeriodUnit": "Week"
        },
        "Language": "ru"
      },
      {
        "StoreId": "9NJJSGSS23P8/0101",
        "Title": "1 год подписки",
        "IsInUserCollection": false,
        "IsTrial": false,
        "Price": {
          "CurrencyCode": "USD",
          "FormattedPrice": "0,00 $",
          "FormattedBasePrice": "0,00 $",
          "FormattedRecurrencePrice": "79,99 $",
          "IsOnSale": false,
          "SaleEndDate": "9998-12-30T03:00:00.0000000"
        },
        "CollectionData": null,
        "IsSubscription": true,
        "SubscriptionInfo": {
          "BillingPeriod": 1,
          "BillingPeriodUnit": "Year",
          "HasTrialPeriod": true,
          "TrialPeriod": 1,
          "TrialPeriodUnit": "Week"
        },
        "Language": "ru"
      },
      {
        "StoreId": "9NJJSGSS23P8/0020",
        "Title": "1 год подписки",
        "IsInUserCollection": true,
        "IsTrial": false,
        "Price": {
          "CurrencyCode": "USD",
          "FormattedPrice": "0,00 $",
          "FormattedBasePrice": "0,00 $",
          "FormattedRecurrencePrice": "0,00 $",
          "IsOnSale": false,
          "SaleEndDate": "9998-12-30T03:00:00.0000000"
        },
        "CollectionData": {
          "CampaignId": "",
          "StartDate": "2020-09-14T03:00:00.0000000",
          "EndDate": "2020-09-24T03:00:00.0000000",
          "AcquiredDate": "2020-09-14T12:26:28.7964538",
          "IsTrial": true,
          "TrialTimeRemaining": "10675199:2:48:05,4775807"
        },
        "IsSubscription": false,
        "SubscriptionInfo": null,
        "Language": "ru"
      }
    ]
  }
]


For the case when a product doesn't have a trial it has 2 skus, but with the same problem as mentioned above:

[
  {
    "StoreId": "9NVCL1M4W3MT",
    "IsInUserCollection": true,
    "Title": "TestSubscription9",
    "ProductKind": "Durable",
    "Price": {
      "CurrencyCode": "USD",
      "FormattedPrice": "0,00 $",
      "FormattedBasePrice": "0,00 $",
      "FormattedRecurrencePrice": "0,00 $",
      "IsOnSale": false,
      "SaleEndDate": "9998-12-30T03:00:00.0000000"
    },
    "HasDigitalDownload": false,
    "InAppOfferToken": "TestSubscription9",
    "Skus": [
      {
        "StoreId": "9NVCL1M4W3MT/0100",
        "Title": "TestSubscription9",
        "IsInUserCollection": false,
        "IsTrial": false,
        "Price": {
          "CurrencyCode": "USD",
          "FormattedPrice": "0,00 $",
          "FormattedBasePrice": "0,00 $",
          "FormattedRecurrencePrice": "0,00 $",
          "IsOnSale": false,
          "SaleEndDate": "9998-12-30T03:00:00.0000000"
        },
        "CollectionData": null,
        "IsSubscription": true,
        "SubscriptionInfo": {
          "BillingPeriod": 1,
          "BillingPeriodUnit": "Month",
          "HasTrialPeriod": false,
          "TrialPeriod": 0,
          "TrialPeriodUnit": "Week"
        },
        "Language": "en"
      },
      {
        "StoreId": "9NVCL1M4W3MT/0020",
        "Title": "TestSubscription9",
        "IsInUserCollection": true,
        "IsTrial": false,
        "Price": {
          "CurrencyCode": "USD",
          "FormattedPrice": "0,00 $",
          "FormattedBasePrice": "0,00 $",
          "FormattedRecurrencePrice": "0,00 $",
          "IsOnSale": false,
          "SaleEndDate": "9998-12-30T03:00:00.0000000"
        },
        "CollectionData": {
          "CampaignId": "",
          "StartDate": "2020-09-14T03:00:00.0000000",
          "EndDate": "2020-10-17T03:00:00.0000000",
          "AcquiredDate": "2020-09-14T12:58:24.8579557",
          "IsTrial": false,
          "TrialTimeRemaining": "10675199:2:48:05,4775807"
        },
        "IsSubscription": false,
        "SubscriptionInfo": null,
        "Language": "en"
      }
    ]
  }
]
partner-center-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

For the second question, I checked the response data. I found that the last SKU is different from the others. The IsSubscription is false and it does not contain the SubscriptionInfo data. You could check it to see if the SKU is usable. For your first question, it looks like a server issue. I'd suggest you open a support ticket about this. Choose to Contact us, select Dashboard for Topic, and select in-app purchase for issue type.


1 Vote 1 ·

0 Answers