Solved

How to handle consumable IAPs without offerings, entitlements etc?

  • 16 February 2024
  • 6 replies
  • 129 views

Badge +4

I have some IAP consumables in the app store, I am implementing RC to expand to android and web..

 

I handle my consumable with storekit2 successfully like this:

  • customer buys the IAP
  • after the transaction is succesful then I add the credits to userdefaults or coredata
  • user use the credits and I manage the counter in the app
  • when counter is 0 then trigger IAP again

 

I am confused how to do this in RC, I assume I just create a product and do not attach offering, entitlements etc?
I just want RC to handle the payment, tell me the customer actually paid and then I’ll handle the rest

 

 

icon

Best answer by nat-serrano 28 February 2024, 11:36

View original

This post has been closed for comments

6 replies

Userlevel 4
Badge +6

Hey @nat-serrano !

 

To do what you are intending, you will just need to add the product to RC, then allow the product to be purchased in your code. I would not add any entitlement to this product as that entitlement would be unlocked forever if you did this for a consumable purchase. 

 

If you add a consumable product to an entitlement, RevenueCat will report that entitlement as unlocked (forever), even after one purchase. This is because there is no expiration date for consumables, like there is for a subscription. This may work for some use-cases, but generally, you wouldn't add a consumable product to an entitlement meant to be unlocked by a subscription.

 

More information on this can be added here: https://www.revenuecat.com/docs/platform-resources/non-subscriptions

 

Let me know if that helps! 

Badge +4

ok I removed the entitlement, I thought that entitlements were mandatory based on what I read in the documentation, I still left the offerings,

 

so that means I need to buy a product using the product identifier right?

the documentation is still confusing about one time purchases, because they still associate the single product purchase with an entitlement, example:
https://www.revenuecat.com/docs/getting-started/making-purchases

// Note: if you are not using offerings/packages to purchase In-app products, you can use purchaseStoreProduct and getProducts

try {
const { customerInfo, productIdentifier } =
await Purchases.purchaseStoreProduct(productToBuy);
if (
typeof purchaseResult.customerInfo.entitlements.active[
"my_entitlement_identifier"
] !== "undefined"
) {
// Unlock that great "pro" content
}
} catch (e) {
if (!e.userCancelled) {
showError(e);
}
}

Userlevel 4
Badge +6

Hey @nat-serrano !

 

Correct, if you are not using offerings you can use the product identifier instead and call purchaseProduct. 

 

More information on this can be found here: https://revenuecat.github.io/react-native-purchases-docs/7.21.1/classes/default.html#purchaseProduct

Badge +4

thanks, but the problem with purchasing products like this is that is no longer agnostic right?

I have product identifiers for android, ios and web. 

then I need to handle the logic inside the app, is this product an ios? yes then use ios identifier. right?

Badge +4

I see this in the logs
 

 

Badge +4

the issue was that I needed to release the DAMN internal track in google play store for the products to become available. possibly you need to add this to your documentation so devs can avoid going crazy debugging something that was working on your side.