Question

How to make consumable purchases multiple times?

  • 7 October 2023
  • 1 reply
  • 23 views

Badge +5

I have created a consumable product and it works so far. Now when the user wants to purchase the same consumable product again, it gives it to them wether they paid again or not because their entitlement exists? How do I fix this? here is the code I have: 

 

 

  
if let package = self.offering?.availablePackages[packageNumber] {
Purchases.shared.purchase(package: package) { (transaction, customerInfo, error, userCancelled) in
print("user cancelled: transaction", userCancelled)
if customerInfo?.entitlements["gems (consumable)"]?.isActive == true {
// Unlock that great "pro" content

} else {
print("Error for payment", error)
}
}
}

 


1 reply

Userlevel 6
Badge +8

Hey @Jordan Peterson!

Consumable products will unlock entitlements permanently. Because of this, you’ll want to either remove your consumable products from your entitlements, or not restrict users from purchasing if the entitlement exists. You can read more in our guide on non-subscription products: https://www.revenuecat.com/docs/non-subscriptions#entitlements

Reply