Displaying Products

Configure Products

Before working with products in SDK, make sure you created all in-app purchases in App Store Connect / Google Play Console, and made necessary set up in Aphud Product Hub. Please follow our Configuring Products guide for details.


There are two ways working with products: using modern Paywalls structure, or fetching native products the old way.
Paywalls structure allows you to easily operate with your products array as well as run A/B experiments on them. You can read more in our Paywalls guide.
Technically, each ApphudPaywall contains array of ApphudProduct objects, paywall identifier, JSON dictionary, and a few other properties.
To get your products from SDK, first retrieve your paywalls by calling:

Task {
	let mainPaywall = await Apphud.paywall(ApphudPaywallID.main.rawValue)
	let apphudProducts = paywall.products
	// setup your UI with these products
Apphud.paywallsDidLoadCallback { paywalls in
    // if paywalls are already loaded, callback will be invoked immediately
    if let paywall = paywalls.first(where: { $0.identifier == "your_paywall_id" }) {
        let products = paywall.products
        // setup your UI with these products
[Apphud paywallsDidLoadCallback:^(NSArray<ApphudPaywall *> * _Nonnull paywalls) { 
[Apphud paywallShown:paywall];
// somewhere in your singleton class

// implement ApphudListener methods
override fun paywallsDidFullyLoad(paywalls: List<ApphudPaywall>) {
	// method is called when paywalls are loaded with their ProductDetails objects  
ApphudSdk.paywallsDidLoadCallback().then((paywalls) => {
   // todo

In callback you can fetch your paywall by identifier. You must provide paywall identifier when adding new paywall in Apphud Product Hub. Here are typical paywall identifier names that you can use: "main", "onboarding", "settings", "over_limit", etc.
Best practice is to have one paywall identifier per view/controller. However, at certain scenarios you may have different paywall identifiers per same class.


Paywall Shown event is used in Apphud analytics.

Please make sure that this method is called just one time per payment screen shown.

Apphud automatically fetches SKProduct / Product /ProductDetails objects upon launch and populates them in paywalls.

To operate with native product model, retrieve it from ApphudProduct wrapper object:

// fetch Product from ApphudProduct object, returns immediately, if available.
let product = await apphudProduct.product()
// returns skProduct object wrapped in ApphudProduct object
[apphudProduct skProduct];
// returns productDetails object wrapped in ApphudProduct object

Fetching Native Products the Old Way

If you don't want to use paywalls, you can still operate with native products array:

let products = try await Apphud.fetchProducts()
// returns nil, if products are not yet loaded from the App Store
Apphud.fetchProducts { products, error in }
[Apphud products];
// returns null, if products are not yet loaded from Google Play
await Apphud.products();
await ApphudSdk.products();

Additional Resources:

What’s Next