Question

Checking if a purchase is a trial

  • 6 November 2023
  • 1 reply
  • 29 views

Badge +2

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!


1 reply

Userlevel 4
Badge +8

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.

Reply