Question

Displaying purchased information

  • 4 November 2023
  • 8 replies
  • 91 views

Badge +5

I like the documentation how to display products, but is there a similar one of how to display active subscriptions?

Once user makes a purchase, I would like to display information about this purchase in a Membership management screen. Currently I am relying on getCustomerInfo().entitlements.active, but that does not describe the products well. I would like to show the display title and description of the product(s) that was purchased at that point in time even if it is not offered anymore.

Is there a way to get full information of the purchase like that is more than identifiers?
 

PS: FIWI in react-native I tried calling 

getProducts(customerInfo.allPurchasedProductIdentifiers)

but that errors out:
Error: Unknown error.
    at Object.promiseMethodWrapper [as getProductInfo]


8 replies

Userlevel 5
Badge +9

Hello,

It sounds like you can do this by looping through allPurchaseDates and allExpirationDates to display this info.

But we recommend simply redirecting the user to their device's subscription settings screen by using the managementURL. That's because this will give you the most accurate info and allow the customer to change their plan if they'd like. It's built into both iOS and Android devices and provides a source of truth for you and your customers. 

Badge +5

Thank you @sharif , but I was looking for more than dates. Like I mentioned in the original post I am looking to show the title and description of the prod. This would be in addition to the managementUrl. 

Do you think having the managementUrl link is enough to pass store reviews? The “Active Subscriptions” screen in the app would be too empty to only have a link so most application show some type of information about the current membership before sending them to the OS screen for a full manage.

Userlevel 5
Badge +9

Yes, I would consider the management screen on the device to be the best representation of a user’s subscriptions. Here is an example from my own phone on sandbox (note it looks much better in production, the sandbox screen uses an outdated design.) There are some apps that simply show a button to “manage subscriptions” that goes right to this screen.

But you can still use the allPurchaseDates and allExpirationDates properties if you want to display more info in your app. Those include the subscription product name and the dates.

 

 

Badge +5

ok I will do that, thanks.

in your screenshot, if you have 2 prices for 1 week configured in App Store but only want to display one to the user. is that possible? It is a bit of a question related that I think is happening here.

Badge +5

@sharif 
I am still getting the errors from the original post sporadically

getProducts(customerInfo.allPurchasedProductIdentifiers)

Error: Unknown error.
    at Object.promiseMethodWrapper [as getProductInfo]

 

Do you know what could cause this error? Like I was saying this is important to show the purchase that was made to the user so I would like to display the products that the user has (not just entitlements).

Userlevel 5
Badge +9

Hi @vic-a563d7,

Are you able to share a little more code? It sounds like an issue with the promise being handled, are you using async/await or then?

Badge +5

yes sure. code is super simple. 

when I call await Purchases.getProducts([]) with an empty array i get back an empty array too. BUT when i call it with a real active product identifier (from play store with format sub:id) then it blows up.

and yes promise is handled correctly.

 

Userlevel 5
Badge +9

@vic-a563d7 Thanks for sharing that. It looks like the issue might be on the device. How are you running the app? I see localhost in the error in your screenshot, are you running it on the web?

Reply