Skip to main content
Question

Checking if a purchase is a trial

  • November 6, 2023
  • 1 reply
  • 135 views

Forum|alt.badge.img+3

Hey RC folks! πŸ‘‹πŸ»

I’m trying to determine after a purchase is made whether or not the purchase was a trial or not. I’m using `try await Purchases.shared.purchase(product: storeProduct)` to make the purchase. 

My initial solution was to iterate through the active entitlements i.e `results.customerInfo.entitlements.active` and try to see if there was a trial, but I was wondering if there’s a more elegant way to do so?

Thanks in advance!

This post has been closed for comments

1 reply

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 586 replies
  • November 8, 2023

Hi, the way you are iterating through the customerInfo for the type trial is one way to do this. Another way can be to use our webhooks and listen for an initial_purchase/renewal event and check if the period_type is trial.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings