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:

For Android

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:

// offerIdToken should be null
// Pass consumableInAppProduct true or false to consume or acknowledge the purchase respectively

Apphud.purchase(activity, product, null, null, null, true)

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

For 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.