Consumable and Non-consumable Purchases

Apphud supports all types of non-renewing purchases, including consumables, non-consumables, and non-renewing subscriptions. These are managed through a NonRenewingPurchase object.

📘

Important

Consumable purchases cannot be restored. That means Apphud is only able to track consumable purchases when Apphud SDK is included in user's the app binary.

Making a Purchase

The process to purchase non-renewing items is quite similar to that of subscriptions, with some platform-specific nuances:

Android

📘

Important Note

Starting Android SDK 2.5.0 consumable purchases are no longer affect hasPremiumAccess method, i.e. being ignored. Only non-consumable purchases affect this method.

When making a purchase, you need to specify if the product is consumable. Use the Apphud.purchase method with an additional parameter consumableInAppProduct set to true.

👍

Important Note

SDK automaically calls consumeAsync or acknowledgePurchase after successful purchase based on the consumableInAppProduct parameter you passed:

// offerIdToken should be null
// Pass consumableInAppProduct true or false to consume or just acknowledge the purchase respectively
Apphud.purchase(activity, product, null, null, null, true)

Set consumableInAppProduct to false in order to just acknowledge the purchase (lifetime product).

Important: If you pass consumableInAppProduct as true, user will be able to purchase this product again and hasPremiumAccess method will return false for this purchase.

Differences Between Consumption and Acknowledgement

Acknowledging
For both consumable and non-consumable products, you need to acknowledge the purchase within three days. Acknowledging a purchase confirms to Google Play that you've received the purchase information and successfully granted the item to the user. Non-consumed and non-acknowledged purchases are refunded automatically after three days.

Consumable purchases
Consumable products require an additional step — consuming. Consuming a product marks it as used and allows the user to purchase it again. This step is not required for non-consumable products since they are typically purchased only once. The consumeAsync method automatically acknowledges the purchase, so there is no need to call acknowledge method.

Non-consumable purchases

In contrast, non-consumed (i.e. lifetime) purchases are just being acknowledged by the SDK. Attempting to repurchase such items will prompt the billing client to return a message indicating the item has already been owned (ITEM_ALREADY_OWNED).

Note that developers still have the option to manually invoke consumeAsync on these lifetime purchases, even though Google Billing originally restricted their re-purchase. By doing so, the non-consumable purchase is converted into a consumable, making it available for re-purchase.

iOS

On iOS devices, the process is straightforward. Simply call the Apphud.purchase method and pass the product as you would normally. More details can be found here: Making Purchases

Check Non-Renewing Purchase Status

Use this method to check whether the user has purchased in-app purchase and it's not refunded. Returns false if was never purchased or is refunded.

Apphud.isNonRenewingPurchaseActive(productIdentifier: "productID")
[Apphud isNonRenewingPurchaseActiveWithProductIdentifier:@"producID"];
Apphud.isNonRenewingPurchaseActive("productID")
await Apphud.isNonRenewingPurchaseActive("producID")
await ApphudSdk.isNonRenewingPurchaseActive("producID")

Get Non-Renewing Purchase Details

To get non-renewing purchases, which contain purchase date, product identifier and cancellation(refund) date, use the following method:

Apphud.nonRenewingPurchases()
[Apphud nonRenewingPurchases];
Apphud.nonRenewingPurchases()
await Apphud.nonRenewingPurchases();
await ApphudSdk.nonRenewingPurchases();

It will return array of NonRenewingPurchase objects that user has ever purchased. In-app purchases are sorted by purchase date.